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 |
|---|---|---|---|---|---|---|
piqa/lpips.py | francois-rozet/spiq | 19 | 55600 | <filename>piqa/lpips.py
r"""Learned Perceptual Image Patch Similarity (LPIPS)
This module implements the LPIPS in PyTorch.
Original:
https://github.com/richzhang/PerceptualSimilarity
References:
.. [Zhang2018] The Unreasonable Effectiveness of Deep Features as a Perceptual Metric (Zhang et al., 2018)
..... | 2.359375 | 2 |
django_ilmoitin/migrations/0003_remove_notificationtemplate_from_email.py | City-of-Helsinki/django-ilmoitin | 2 | 55601 | <filename>django_ilmoitin/migrations/0003_remove_notificationtemplate_from_email.py
# Generated by Django 2.2.8 on 2020-01-03 21:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("django_ilmoitin", "0002_add_admin_notifications")]
operations = [
migrations.... | 1.359375 | 1 |
app/user/urls.py | tuipik/starnavi | 0 | 55602 | <reponame>tuipik/starnavi
from django.urls import path
from .views import (UserRegistrationView,
UserLoginView,
UserProfileView,
UserAnaliticsView
)
app_name = 'user'
urlpatterns = [
path('signup/', UserRegistrationView.as_view(), nam... | 1.789063 | 2 |
WeChatSpider/cookies/cookies_gen.py | Times125/wechatSpider | 18 | 55603 | <filename>WeChatSpider/cookies/cookies_gen.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author:_defined
@Time: 2018/10/12 15:02
@Description:
"""
import hashlib
import random
import time
from werkzeug.contrib.cache import FileSystemCache
__all__ = ['suv_gen', 'CookiesCache']
def suv_gen():
mills = r... | 2.265625 | 2 |
tests/CommunicationTest.py | SigurdVilstrup/TheGeneralBlockchain | 0 | 55604 | from sys import argv
from context import TGB
if __name__ == '__main__':
print('Running communication smoketest.')
if len(argv) == 1:
print('please input local address for testing the communication as an argument\nEx. %s 111.111.11.11' % (
argv[0]))
quit()
if len(argv) == 2:
... | 2.375 | 2 |
test_pytrain/test_Template.py | pytrain/pytrain-shallow | 20 | 55605 | #
# test template
#
# @ author becxer
# @ email <EMAIL>
#
from test_pytrain import test_Suite
class test_Template(test_Suite):
def __init__(self, logging = True):
test_Suite.__init__(self, logging)
def test_process(self):
global_value = self.get_global_value('some_key')
self.set_glob... | 2.15625 | 2 |
tests/base/test_mass_matrices.py | ElliotCheung/simpeg | 1 | 55606 | <reponame>ElliotCheung/simpeg<filename>tests/base/test_mass_matrices.py
from SimPEG.base import with_property_mass_matrices, BasePDESimulation
from SimPEG import props, maps
import unittest
import discretize
import numpy as np
from scipy.constants import mu_0
from discretize.tests import check_derivative
from discretiz... | 2.140625 | 2 |
ception/articles/urls.py | zyshin/Ception | 2 | 55607 | <filename>ception/articles/urls.py<gh_stars>1-10
from django.conf.urls import patterns, url
urlpatterns = patterns('ception.articles.views',
url(r'^$', 'articles', name='articles'),
url(r'^write/$', 'write', name='write'),
url(r'^preview/$', 'previe... | 1.992188 | 2 |
apps/promotions/serializers.py | lsdlab/djshop_toturial | 0 | 55608 | <reponame>lsdlab/djshop_toturial
from rest_framework import serializers
from .models import (ProductPromotion, Promotion, Log)
from apps.products.serializers import ProductCartSerializer
from apps.users.serializers import UserPublicInfoSerializer
class ProductPromotionSerializer(serializers.ModelSerializer):
prod... | 2.1875 | 2 |
explorebg/home/views.py | bvoytash/Quiz-Application | 0 | 55609 | from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
# @method_decorator(cache_page(60 * 10), name='dispatch')
class HomePageView(TemplateView):
template_name = 'home/home.html'
... | 2.0625 | 2 |
src/plotly_test/template_ex1.py | jiaweiM/plot-note | 0 | 55610 | import plotly.graph_objects as go
large_rockwell_template = dict(
layout=go.Layout(title_font=dict(family="Rockwell", size=24))
)
fig = go.Figure()
fig.update_layout(title='Figure Title', template=large_rockwell_template)
fig.show()
| 2.375 | 2 |
python_docs/24Classes/05Object_accessors.py | Matheus-IT/lang-python-related | 0 | 55611 | <reponame>Matheus-IT/lang-python-related<filename>python_docs/24Classes/05Object_accessors.py
class Student():
def __init__(self):
self._name = 'John'
self._age = 18
self._grades = [9.5, 5.75, 10]
s1 = Student()
# Verify if s1 has the attribute 'name':
print(hasattr(s1, 'name'))... | 3.765625 | 4 |
__init__.py | opa-oz/sonar-game | 0 | 55612 | <reponame>opa-oz/sonar-game
from constants import WELCOME_STRING, BOARD_HEIGHT, BOARD_WIDTH, ViewSymbols
from bcolors import BColors
from random import choice, randint
EMPTY = '='
SONAR = 's'
TREASURE = 't'
def get_random_chests(count, width, height):
chests = []
for i in range(count):
chests.append(... | 2.96875 | 3 |
tests/urls.py | Edraak/django-ratelimit-backend | 95 | 55613 | from django.conf.urls import url
from ratelimitbackend import admin
from ratelimitbackend.views import login
from .forms import CustomAuthForm, TokenOnlyAuthForm
urlpatterns = [
url(r'^login/$', login,
{'template_name': 'admin/login.html'}, name='login'),
url(r'^custom_login/$', login,
{'tem... | 1.789063 | 2 |
Patent_US20020125774A1_Molina_Martinez_Generator/Version_1/assembly.py | Jay4C/Python-Macros-For_FreeCAD | 0 | 55614 | <filename>Patent_US20020125774A1_Molina_Martinez_Generator/Version_1/assembly.py
import FreeCAD, Part, Mesh, math
DOC = FreeCAD.activeDocument()
DOC_NAME = "assembly"
def clear_doc():
# Clear the active document deleting all the objects
for obj in DOC.Objects:
DOC.removeObject(obj.Name)
def setvie... | 2.109375 | 2 |
real-world-examples/rename_files.py | AlienCoders/learning-python | 19 | 55615 | #!/usr/bin/python
# This is the second program shown in Kunal chawla's prank project in udacity's Programming foundation with Python.
import os
def rename_files():
#(1) get fle names in an array from a directory
# give your directory path based on OS
file_list = os.listdir(r"/home/sanjeev/prank")
saved_path =... | 4.21875 | 4 |
_scripts/_integrity.py | deathbeds/wxyz | 23 | 55616 | """ integrity checks for the wxyz repo
"""
import re
# pylint: disable=redefined-outer-name
import sys
import tempfile
from pathlib import Path
import pytest
from . import _paths as P
PYTEST_INI = """
[pytest]
junit_family = xunit2
"""
@pytest.fixture(scope="module")
def contributing_text():
"""the text of CO... | 2.171875 | 2 |
scripts/backups/collect.py | basilpork/checkniner | 2 | 55617 | import datetime
import hashlib
import logging
import os
import tarfile
from azure.storage.blob import BlockBlobService
from boto.s3.connection import S3Connection
from boto.s3.bucket import Bucket
from boto.s3.key import Key
import dj_database_url
import django # Provides django.setup()
from django.apps import apps a... | 1.882813 | 2 |
setup.py | alecx/nibeuplink | 0 | 55618 | <reponame>alecx/nibeuplink
from setuptools import setup, find_packages
setup(
name='nibeuplink',
version='0.4.3',
description='A python wrapper around Nibe Uplink REST API',
license='MIT',
packages=find_packages('src'),
package_dir = {'': 'src'},
python_requires='>3.5',
author='<NAME>',... | 1.28125 | 1 |
forest_puller/viz/correlation.py | xapple/forest_puller | 1 | 55619 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by <NAME> and <NAME>.
JRC Biomass Project.
Unit D1 Bioeconomy.
"""
# Built-in modules #
# Internal modules #
from forest_puller.viz.helper.multiplot import Multiplot
from forest_puller import cache_dir
from forest_pul... | 2.4375 | 2 |
scripts/plot_results.py | HenningTimm/bpht_evaluation_workflow | 0 | 55620 | <gh_stars>0
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import re
def file_to_df(file_path):
pattern = "genome=(.+)_s=(\d+)_H=(\d+)_q=(\d+)"
genome, size, h, q = re.search(pattern, file_path).groups()
keys = ["genome", "size", "h", "q"]
values = [genome, int(size), int(h)... | 2.609375 | 3 |
stick_mouse_pos.py | sevenjames/fpie-scripts | 0 | 55621 | """
Script to control mouse cursor with gamepad stick.
Specifically: right stick x axis controls mouse x position.
Requires FreePIE: https://github.com/AndersMalmgren/FreePIE
2020-06-11 JAO
"""
if starting:
"""This block only runs once."""
import time
joy_id = 0 # gamepad device number
x_axis_mult = 0.... | 2.953125 | 3 |
Analysis/apps.py | psymen145/OVS-django-fe | 0 | 55622 | <reponame>psymen145/OVS-django-fe
from django.apps import AppConfig
class AnalysisConfig(AppConfig):
name = 'Analysis'
| 1.335938 | 1 |
projects/vdk-heartbeat/tests/vdk/internal/test_config.py | alod83/versatile-data-kit | 100 | 55623 | <filename>projects/vdk-heartbeat/tests/vdk/internal/test_config.py
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import os
import tempfile
from unittest import mock
import pytest
from vdk.internal.heartbeat.config import Config
@mock.patch.dict(
os.environ,
{
"VDKCLI_OAUTH2_REFR... | 2.1875 | 2 |
flytekit/common/tasks/sagemaker/distributed_training.py | slai/flytekit | 0 | 55624 | import json as _json
import os as _os
import retry as _retry
from flytekit.common.tasks import sdk_runnable as _sdk_runnable
from flytekit.engines import common as _common_engine
SM_RESOURCE_CONFIG_FILE = "/opt/ml/input/config/resourceconfig.json"
SM_ENV_VAR_CURRENT_HOST = "SM_CURRENT_HOST"
SM_ENV_VAR_HOSTS = "SM_HO... | 1.867188 | 2 |
marauder/app.py | shonenada/bearychat-in-cli | 0 | 55625 | <gh_stars>0
# -*- coding: utf-8 -*-
import sys
from functools import partial
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.exceptions import ResizeScreenError
from marauder.client import Client
from marauder.view.name import Names
from marauder.view.home import HomeView
f... | 2.1875 | 2 |
bxemu/strategy.py | phonegapX/bxemu | 5 | 55626 | <filename>bxemu/strategy.py
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from six import with_metaclass
class StrategyTemplate(with_metaclass(ABCMeta)):
"""
策略模板
"""
def __init__(self, pm):
"""Constructor"""
self.pm = pm
@abstractmethod
... | 2.984375 | 3 |
solution/424. longest-repeating-character-replacement.py | sundaycat/Leetcode-Practice | 0 | 55627 | class Solution:
'''
1. char_freq count and updates the char frequent of current window and updates accordingly as the window moves forward. so it dosen't need to delete the elements when the count become 0.
2. window length - window max_count > windown length - global max_count > k. If window length - most... | 3.625 | 4 |
DiscordOAuth2/urls.py | IamEinstein/django-bank | 1 | 55628 | <reponame>IamEinstein/django-bank
from django.urls import path
from .views import *
app_name = "discord"
urlpatterns = [
path('', LoginView.as_view(), name="verify")
]
| 1.78125 | 2 |
PerformanceMetricsScript/Old Scripts/PerformanceMetricParserLocal.py | ShivKushwah/PSec-Anonymous | 4 | 55629 | <gh_stars>1-10
import re
import subprocess
import time
import json
import statistics
import time
import os
num_iterations = 2
is_sim = True
#Move program to root context
os.chdir('..')
#Words to parse
search_lst1 = ['MEASURE UNTRUSTED CREATE START', 'MEASURE UNTRUSTED CREATE SSM START', 'MEASURE TRUSTED CREATE STAR... | 1.914063 | 2 |
setup.py | unnecessary-abstraction/betatest | 0 | 55630 | #
# betatest setup script
#
# Copyright (c) 2018 Beta Five Ltd
#
# SPDX-License-Identifier: Apache-2.0
#
import re
import runpy
import setuptools
import sys
# Check minimum python version
if sys.version_info < (3,6):
print('ERROR: betatest requires Python 3.6+')
sys.exit(1)
# Pick up the version number from ... | 1.789063 | 2 |
pydatasentry/attributes.py | FourthLion/pydatasentry | 6 | 55631 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
These are the set of attributes that can be computed for each run. The
configuration specifies which subset of these should be stored, how
and where.
The attributes provide a fairly expressive language to collect
information recursively. Each attribute can combine ... | 2.359375 | 2 |
cliente/admin.py | Moisestuli/karrata | 0 | 55632 | from django.contrib import admin
from cliente.models import Cliente
admin.site.register(Cliente)
| 1.195313 | 1 |
Graphy/tests/utils/test_dict.py | andrepbento/OpenTracingProcessor | 4 | 55633 | """
Author: <NAME>
Date last modified: 01-03-2019
"""
from unittest import TestCase
from graphy.utils import dict as my_dict
class TestDict(TestCase):
def test_calc_percentage(self):
""" Tests calc_percentage function. """
test_dict = {'0': 1, '1': 1, '2': 2}
right_result_dict =... | 2.984375 | 3 |
paymentwall/onetimetoken.py | bilabon/paymentwall-python | 0 | 55634 | from paymentwall.apiobject import ApiObject
class OneTimeToken(ApiObject):
def __init__(self):
super().__init__(self, obj='token')
def get_token(self):
return self.get_response()['token']
def is_active(self):
return self.get_response()['active']
def get_expiration_time(self)... | 2.390625 | 2 |
xcx_interface/route/menu_r.py | linjingheng-dev/python_service | 8 | 55635 | from django.urls import path
from xcx_interface.controller.menu.menu_msg import getMenuList
urlpatterns = [
# 获取菜单列表
path('getMenuList', getMenuList, name='getMenuList')
]
| 1.53125 | 2 |
counter.py | alexhalme/getcount | 0 | 55636 | import _clibash
import locaf as af
from locaf import En
import time
import json
from wsql import WSQL
import re
from starlette.responses import JSONResponse
import sms
import yaml
import uvicorn
from fastapi import FastAPI
from starlette.requests import Request
app = FastAPI()
CONF = af.MakeObj(yaml.safe_load(af.io... | 2.296875 | 2 |
ballard_weather_service/__main__.py | kwierman/ballard-weather-service | 0 | 55637 | <reponame>kwierman/ballard-weather-service
from ballard_weather_service import cli
cli.cli()
| 1.0625 | 1 |
Core/third_party/JavaScriptCore/wasm/generateWasmB3IRGeneratorInlinesHeader.py | InfiniteSynthesis/lynx-native | 677 | 55638 | #!/usr/bin/env python
# Copyright (C) 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:n
#
# 1. Redistributions of source code must retain the above copyright
# notice, this li... | 1.625 | 2 |
scripts/cam_driver.py | lsd-maddrive/elp_stereo_camera | 1 | 55639 | #!/usr/bin/env python
import rospy
from sensor_msgs.msg import Image, CameraInfo
import os.path
import cv2
from cv_bridge import CvBridge, CvBridgeError
import time
IMAGE_MESSAGE_TOPIC = 'image_color'
CAMERA_MESSAGE_TOPIC = 'cam_info'
rospy.init_node('video_2_camera_stream')
device_path = rospy.get_param('~dev', ... | 2.5 | 2 |
portal/apps/core/views/edition.py | Artis-Physis/utopia-cms | 8 | 55640 | <reponame>Artis-Physis/utopia-cms<filename>portal/apps/core/views/edition.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from datetime import date, timedelta
from django.conf import settings
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.http impo... | 1.9375 | 2 |
src/704-binary-search.py | sahilrider/LeetCode-Solutions | 2 | 55641 | '''https://leetcode.com/problems/binary-search/'''
class Solution:
def search(self, nums: List[int], target: int) -> int:
l, h = 0, len(nums)-1
while l<=h:
m = (l+h)//2
if nums[m]==target:
return m
elif nums[m]>target:
h = m-1
... | 3.59375 | 4 |
mnist/replay/train_gan.py | limberc/hypercl | 0 | 55642 | <gh_stars>0
#!/usr/bin/env python3
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 1.984375 | 2 |
exonetapi/structures/__init__.py | exonet/exonet-api-python | 0 | 55643 | <reponame>exonet/exonet-api-python
from .ApiResource import ApiResource
from .ApiResourceIdentifier import ApiResourceIdentifier
from .ApiResourceSet import ApiResourceSet
| 0.894531 | 1 |
tests/test_day_06.py | maddenvvs/advent-of-code-2021 | 0 | 55644 | <filename>tests/test_day_06.py
import pytest
from aoc2021.day_06 import first_task, second_task, number_of_fishes, parse_fishes
TEST_FISHES = """3,4,3,1,2"""
@pytest.mark.parametrize(
"days,expected_fishes",
[
(1, 5),
(2, 6),
(3, 7),
(4, 9),
(5, 10),
(6, 10),
... | 2.609375 | 3 |
SORTING/BubbleSort.py | uditmaherwal/Algorithms | 1 | 55645 | <gh_stars>1-10
def bubblesort(array):
length = len(array)-1
for i in range(length,0,-1):
for j in range(i):
if array[j] > array[j+1]:
array[j],array[j+1]=array[j+1],array[j]
| 3.71875 | 4 |
Program's_Contributed_By_Contributors/Python_Programs/MatrixTracing.py | a-ayush19/Hacktoberfest2k21 | 1 | 55646 | <filename>Program's_Contributed_By_Contributors/Python_Programs/MatrixTracing.py
#!/bin/python3
import math
import os
import random
import re
import sys
#
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER n
# 2. INTEGER m
#
def solve(n, m):
inv=lambda ... | 3.734375 | 4 |
Medium/TopKFrequentWord.py | AvivSham/LeetCodeQ | 0 | 55647 | from typing import List
from collections import Counter
def top_k_frequent(words: List[str], k: int) -> List[str]:
words = sorted(words)
freq = Counter(words)
freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)
return [i[0] for i in freq[:k]]
if __name__ == '__main__':
pr... | 3.6875 | 4 |
DCS311 Artificial Intelligence/CNN/cnn.py | Lan-Jing/Courses | 1 | 55648 | <gh_stars>1-10
import numpy as np
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
class base(nn.Module):
def __init__(self):
super(base, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16... | 2.59375 | 3 |
mmdet/models/detectors/detr.py | colinski/mmdetection | 0 | 55649 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
from ..builder import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module()
class DETR(SingleStageDetector):
r"""Implementation of `DETR: End-to-End Object Detection with
Transformers <https://arxiv.o... | 2.15625 | 2 |
riemann.py | NullOsama/Integrals | 1 | 55650 | import numpy as np
import matplotlib.pyplot as plt
from .integrate import Integrate
class Riemann(Integrate):
"""
Compute the Riemann sum of f(x) over the interval [a,b].
Parameters
----------
f : function
A single variable function f(x), ex: lambda x:np.exp(x**2)
"""
def _... | 3.953125 | 4 |
train.py | JerryJack121/regression-LSTM-PyTorch | 0 | 55651 | import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import utils
from torch.utils.data import Dataset, DataLoader
from net import model
import math
from tqdm import tqdm
import matplotlib.pyplot as plt
import os
from sklearn.preprocessing import StandardScaler
from torch.optim import lr_scheduler
... | 2.484375 | 2 |
pricemoovtestapp/users/models.py | cterence/pricemoov-django-testapp | 0 | 55652 | from django.db import models
class User(models.Model):
id = models.AutoField(primary_key=True, blank=True)
first_name = models.CharField(max_length=200)
last_name = models.CharField(max_length=200)
login = models.CharField(max_length=200, unique=True)
password = models.CharField(max_length=200)
... | 2.28125 | 2 |
test/functional/ltm/__init__.py | yuanfm/f5-common-python | 0 | 55653 | <gh_stars>0
__author__ = 'wormke'
| 1.023438 | 1 |
tiko/stats.py | rwhitt2049/thyro | 0 | 55654 | import numpy as np
from scipy import stats
__all__ = ['register_stat']
statistic_factory = {
'min': np.min,
'max': np.max,
'mean': np.mean,
'median': np.median,
'std': np.std,
'sum': np.sum,
'cumsum': np.cumsum,
}
def register_stat(func=None, name=None):
"""Function to register sta... | 3.109375 | 3 |
shop/serializer.py | threecoolcat/ThreeCoolCat | 6 | 55655 | from rest_framework import serializers
from .models import Book, Video
class BookSerializer(serializers.ModelSerializer):
class Meta:
model = Book
fields = "__all__"
class VideoSerializer(serializers.ModelSerializer):
class Meta:
model = Video
fields = "__all__"
| 2.171875 | 2 |
app/__init__.py | Mateus-Brito/flask-start | 1 | 55656 | <gh_stars>1-10
from flask import Flask
import os
import sys
import os.path as path
from .views import start_controller
from .account import account_controller
from .dashboard import dashboard_controller
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String
from flask_migrate im... | 2.3125 | 2 |
dvd_store/store.py | soundzofstatic/dvd_store | 0 | 55657 | import csv
class Store:
__INVENTORY_FILE = "products.csv"
def __init__(self, name, taxRate):
self.__Inventory = self.auditInventory()
self.__name = name
self.__taxRate = taxRate
def getName(self):
return self.__name
def getTaxRate(self):
re... | 3.671875 | 4 |
CMI-L1S2/MATH202_MIST/tp2/tp2.py | Matows/USMB | 0 | 55658 | #!/usr/bin/env python3
# coding: utf-8
def position(T, s):
"""renvoie la position de la chaine s dans la liste T
Si s n'appartient pas à la liste T, la fonction renvoie -1 à la place.
T: liste de chaine de caractères
s: chaine de caractère
résultat: nombre entier
"""
try:
return T... | 3.609375 | 4 |
create_targets.py | gugarosa/gan_metrics_scoring | 0 | 55659 | import argparse
import numpy as np
import utils.loader as l
def get_arguments():
"""Gets arguments from the command line.
Returns:
A parser with the input arguments.
"""
# Creates the ArgumentParser
parser = argparse.ArgumentParser(
usage='Digitizes a numpy array into interval... | 3.140625 | 3 |
features/steps/navigate_homepage_LastAuctions.py | PushEat/PushEat | 1 | 55660 | <gh_stars>1-10
import time
from behave import *
use_step_matcher("re")
@when("I want see LastAuctions section")
def step_impl(context):
context.browser.visit(context.get_url('home'))
context.browser.find_by_id('nonregLAuctions').first.click()
@then("I can see at least 1 auction")
def step_impl(context):
... | 2.203125 | 2 |
applications/plugins/SofaPython/python/SofaPython/Tools.py | sofa-framework/issofa | 0 | 55661 | import Sofa
import os, os.path
import json
import glob
import units
def listToStr(x):
""" concatenate lists for use with data.
"""
return ' '.join(map(str, x))
def listListToStr(xx):
""" concatenate lists of list for use with data.
"""
str_xx=""
for x in xx:
str_xx += listToStr(x... | 2.734375 | 3 |
node/__main__.py | Endeavour-Services/bareblock | 0 | 55662 | import json
import queue
from concurrent.futures import ThreadPoolExecutor
import flask
from flask import Response, jsonify, request
from jsonschema import validate
from node.gpg_utils import *
from node.schema import property_schema
from node.utils import BlockList, get_hash
# currently its using inmemory, can be c... | 2.4375 | 2 |
tests/test_mongo_storage.py | ekapratama93/thumbor-mongodb | 1 | 55663 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2020 <NAME> <<EMAIL>>
import time
from preggy import expect
from tornado.ioloop import IOLoop
from tornado.... | 1.867188 | 2 |
confignet/metrics/controllability_metric_configs.py | microsoft/ConfigNet | 82 | 55664 | <gh_stars>10-100
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from collections import namedtuple
import inspect
ControllableAttributeConfig = namedtuple("ControllableAttributeConfig", "driven_attribute ignored_attributes facemodel_param_name facemodel_param_value facemodel_param_value_... | 2.453125 | 2 |
test.py | Tesla2fox/rescuePathPlanning | 0 | 55665 | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 8 16:04:50 2018
@author: robot
"""
| 0.988281 | 1 |
handlers/signup.py | kevink1986/my-first-blog | 0 | 55666 | from base import BaseHandler
from functions import *
from models import User
class SignupHandler(BaseHandler):
"""Sign up handler that is used to signup users."""
def get(self):
self.render("signup.html")
def post(self):
error = False
self.username = self.request.get("username")
... | 2.96875 | 3 |
stations/medic/admin.py | boyombo/django-stations | 0 | 55667 | <filename>stations/medic/admin.py
from django.contrib import admin
from medic.models import BloodType, Location, Subscriber, BloodRequest,\
Message, Candidate, BloodBank
@admin.register(BloodType, Location)
class LocationAdmin(admin.ModelAdmin):
pass
@admin.register(Subscriber)
class SubscriberAdmin(admin.... | 1.960938 | 2 |
medium/3Sum/solution.py | ashutosh1919/leetcode-problems | 8 | 55668 | <filename>medium/3Sum/solution.py
# Time complexity: O(n^2)
# Approach: Fix one and then based on that loop over other numbers.
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
n = len(nums)
if n < 3:
return []
nums = sorted(nums)
ans = []
... | 3.671875 | 4 |
codes/28-dict_methods.py | kaixiang1992/python-learning | 0 | 55669 | '''
@description 2019/09/14 13:38
'''
# 字典常用方法:
# 1.clear:清除字典所有的项。
person1 = {'username': 'zhiliao', 'age': 18, 'weight': 160, 'height': 180}
person2 = person1
print(person1) # {'username': 'zhiliao', 'age': 18}
print(person2) # {'username': 'zhiliao', 'age': 18}
# 使用clear清除了,person1和person2的引用
# person1.clear()
#... | 3.703125 | 4 |
tests/cli/delete/test_cli_delete_file.py | Clinical-Genomics/housekeeper | 2 | 55670 | """Tests for delete CLI functions"""
import logging
from click import Context
from click.testing import CliRunner
from housekeeper.cli import delete
def test_delete_non_existing_file(base_context: Context, cli_runner: CliRunner, caplog):
"""Test to delete a non existing file"""
caplog.set_level(logging.DEBU... | 2.78125 | 3 |
example.py | d-corsi/BasicRL | 2 | 55671 | from BasicRL.BasicRL import BasicRL
from BasicRL.MyPlotter import MyPlotter
import gym, glob
if __name__ == "__main__":
print("Hello Basic RL example!")
# Load Gym Env
env = gym.make("CartPole-v1")
# Run PPO Algorithm
learner = BasicRL("PPO", gym_env=env, verbose=2, gamma=0.99, sigma=1.0, exploration_decay=0.9... | 2.640625 | 3 |
test/test_glyphwise.py | colinmford/coldtype | 0 | 55672 | import unittest
from pathlib import Path
from coldtype.grid import Grid
from coldtype.geometry import *
from coldtype.color import hsl
from coldtype.text.composer import StSt, Glyphwise, Style, Font
from coldtype.pens.draftingpens import DraftingPens
from coldtype.pens.svgpen import SVGPen
tf = Path(__file__).parent
... | 2.296875 | 2 |
utils/cli/png_to_jpg.py | zvs08/cvat | 0 | 55673 | #!/usr/local/bin/python3
import os
import sys
from PIL import Image
import re
# Converts multiple video files to images in corresponding individual folder:
# - dir
# - images
# - frame_000001.PNG
# - frame_000002.PNG
#
#
def video_to_images(dir):
dir = os.path.join(dir, 'images')
for filena... | 3.25 | 3 |
LeetCode-All-Solution/Python3/LC-1631-Path-With-Minimum-Effort.py | YuweiYin/Algorithm_YuweiYin | 0 | 55674 | <reponame>YuweiYin/Algorithm_YuweiYin
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-1631-Path-With-Minimum-Effort.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date :... | 4.1875 | 4 |
example.py | duanyytop/ckb-sdk-python | 1 | 55675 | <gh_stars>1-10
from ckb_toolkit.core.signer import sign_tx
from ckb_toolkit.core.rpc import RPCClient
from ckb_toolkit.core.hash import ckb_blake160
from ckb_toolkit.core.hex_coder import hex_to_bytes, hex_from_bytes
from ckb_toolkit.address.address import generateShortAddress, generateFullAddress
from coincurve import... | 1.523438 | 2 |
fair_ssl/data/german.py | martinmamql/conditional_infonce | 0 | 55676 | import numpy as np
import pandas as pd
import tensorflow as tf
tfd = tf.contrib.distributions
def create_german_datasets(batch=64):
def gather_labels(df):
labels = []
for j in range(df.shape[1]):
if type(df[0, j]) is str:
labels.append(np.unique(df[:, j]).tolist())
... | 2.453125 | 2 |
operators/trainer.py | ys10/Tacotron-cn | 2 | 55677 | # coding=utf-8
from tqdm import tqdm
from base.base_train import BaseTrain
from utils.signal_process import plot_alignment
class TacotronTrainer(BaseTrain):
def __init__(self, sess, model, data_loader, config, logger):
super(TacotronTrainer, self).__init__(sess, model, data_loader, config, logger)
d... | 2.34375 | 2 |
steemit.py | tolgahanuzun/feroniobot | 0 | 55678 | from steem import Steem
from datetime import datetime, date, timedelta
from math import ceil, log, isnan
import requests
API = 'https://api.steemjs.com/'
def tag_filter(tag, limit = 10):
tag_search = Steem()
tag_query = {
"tag":tag,
"limit": limit
}
tag_filters = tag_search.get_dis... | 2.453125 | 2 |
triggers/__init__.py | todofixthis/triggers | 2 | 55679 | # coding=utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
from .manager import *
from .storages import *
| 0.988281 | 1 |
tests/test_graphapi.py | awong1900/tornado-wio-sdk | 0 | 55680 | <reponame>awong1900/tornado-wio-sdk<filename>tests/test_graphapi.py
# -*- coding: utf-8
# Copyright 2012 <NAME><<EMAIL>>
# 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.apa... | 2.21875 | 2 |
lib/smisk/serialization/yaml_serial.py | rsms/smisk | 4 | 55681 | <filename>lib/smisk/serialization/yaml_serial.py
# encoding: utf-8
'''
YAML: Human-readable data serialization
:see: `YAML 1.1 <http://yaml.org/spec/1.1/>`__
:requires: `PyYAML <http://pyyaml.org/wiki/PyYAML>`__
'''
import sys, logging
log = logging.getLogger(__name__)
from smisk.serialization import serializers, Seri... | 2.28125 | 2 |
tafl/pitTafl.py | user01/alpha-zero-general | 2,836 | 55682 | <filename>tafl/pitTafl.py<gh_stars>1000+
# Note: Run this file from Arena directory (the one above /tafl)
import Arena
from MCTS import MCTS
from tafl.TaflGame import TaflGame, display
from tafl.TaflPlayers import *
#from tafl.keras.NNet import NNetWrapper as NNet
import numpy as np
from utils import *
"""
use this... | 2.328125 | 2 |
keepachangelog/flask_restx.py | Mulugruntz/keepachangelog | 20 | 55683 | from typing import Union
import flask_restx
import flask
from keepachangelog._changelog import to_dict
def add_changelog_endpoint(
namespace: Union[flask_restx.Namespace, flask_restx.Api], changelog_path: str
):
"""
Create /changelog: Changelog endpoint parsing https://keepachangelog.com/en/1.0.0/
... | 2.234375 | 2 |
1000-1100q/1044.py | rampup01/Leetcode | 990 | 55684 | '''
Given a string S, consider all duplicated substrings: (contiguous) substrings of S that occur 2 or more times. (The occurrences may overlap.)
Return any duplicated substring that has the longest possible length. (If S does not have a duplicated substring, the answer is "".)
Example 1:
Input: "banana"
Output... | 3.828125 | 4 |
youtube_stream/mute_shell.py | sanjib-sen/youtube-stream | 0 | 55685 | <reponame>sanjib-sen/youtube-stream
import os, sys
# Link: https://github.com/spatialaudio/python-sounddevice/issues/11#issuecomment-155836787
'''
It seems to work by running this before each PortAudio call:
devnull = os.open(os.devnull, os.O_WRONLY)
old_stderr = os.dup(2)
sys.stderr.flush()
os.dup2(devnull, 2)
os.c... | 2.375 | 2 |
bust_or_boom/bust_or_boom.py | Shom770/data-science-projects | 0 | 55686 | import bisect
import math
import operator
from datetime import timedelta
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
import matplotlib.font_manager as font_manager
import matplotlib.patheff... | 1.867188 | 2 |
devBlag/admin.py | tehsmeely/DjangaeScaffold | 1 | 55687 | <gh_stars>1-10
from django.contrib import admin
# Register your models here.
from .models import \
Post, Resource_image, Resource_code, Resource_download, Project, Developer
admin.site.register(Post)
admin.site.register(Project)
admin.site.register(Developer)
admin.site.register(Resource_image)
admin.site.register(... | 1.421875 | 1 |
krakenapi/api/views.py | Keril-png/kraken-test | 0 | 55688 | <gh_stars>0
from django.shortcuts import render
import json
import requests
from urllib.request import urlopen
from .models import Rec
from rest_framework.decorators import api_view
from rest_framework.response import Response
from datetime import datetime, date, time, timedelta
from .serializers import RecSerializer
f... | 2.234375 | 2 |
Python_beyondBasics/resolver/resolver.py | pjbaudin/Python_path | 0 | 55689 | <reponame>pjbaudin/Python_path
# Time the response time to resolve a website IP address
# from timeit import timeit
# timeit(setup="from __main__ import resolve", stmt="resolve("python.org")", number=1)
import socket
class Resolver:
def __init__(self):
self._cache = {}
def __call__(self, host):
... | 3.015625 | 3 |
legacy/resources/scheduler.py | hiidef/hiispider | 2 | 55690 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Scheduler Resource"""
from hiispider.resources.base import BaseResource
class SchedulerResource(BaseResource):
isLeaf = True
def __init__(self, schedulerserver):
self.schedulerserver = schedulerserver
BaseResource.__init__(self)
def rend... | 1.820313 | 2 |
src/sdgen/fields/_field.py | PP-TSD/sdgen | 1 | 55691 | # -*- coding: utf-8 -*-
from sdgen._configurable_mixin import ConfigurableMixin
from sdgen.utils import helpers
class Field(ConfigurableMixin):
"""Abstract base *field* class.
Each field represents simple or complex graphical element, for example:
:class:`sdgen.fields.character.Character` or
:cla... | 2.59375 | 3 |
sho_sr.py | wongsihan/DeepSymReg | 30 | 55692 | import tensorflow as tf
import numpy as np
import os
import pickle
from utils.symbolic_network import SymbolicNet, MaskedSymbolicNet, SymbolicCell
from utils import functions, regularization, helpers, pretty_print
import argparse
def main(results_dir='results/sho/test', trials=1, learning_rate=1e-2, reg_weight=2e-4, ... | 2.34375 | 2 |
tests/test_blocks.py | springload/wagtaildraftail | 26 | 55693 | <gh_stars>10-100
from __future__ import absolute_import, unicode_literals
import unittest
from django.test import override_settings
from wagtaildraftail import blocks, draft_text, forms, widgets
class DraftailTextBlockTestCase(unittest.TestCase):
def test_get_default_with_string_default(self):
class S... | 2.34375 | 2 |
LeetcodeAlgorithms/265. Paint House II/paint-house-ii.py | Fenghuapiao/PyLeetcode | 3 | 55694 | class Solution(object):
def minCostII(self, costs):
"""
:type costs: List[List[int]]
:rtype: int
"""
if not costs:
return 0
dp = [[0] * len(costs[0]) for _ in xrange(0, len(costs))]
dp[0] = costs[0]
for i in xrange(1, len(costs)):... | 2.953125 | 3 |
eveonline-assistant/users/models.py | wengole/eveonline-assistant | 1 | 55695 | <gh_stars>1-10
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
def has_apikeys(self):
"""
Does this user have an API Keys registered
:return: :rtype: bool
"""
return self.api_keys.count() > 0
def has_disabled_characters(self):
""... | 2.5 | 2 |
test/javascript/test_Javascript_Parser.py | pbx-gs/OSBot_browser | 0 | 55696 | from unittest import TestCase
from urllib.parse import urljoin
import pytest
from osbot_browser.javascript.Javascript_Parser import Javascript_Parser
from osbot_utils.testing.Duration import Duration
from osbot_utils.decorators.methods.cache_on_tmp import cache_on_tmp
from osbot_utils.utils.Http import GET
from os... | 2.1875 | 2 |
setup.py | SignalOceanSdk/SignalSDK | 10 | 55697 | from setuptools import setup, find_packages
from os import path
import re
def read_file(file_name: str) -> str:
here = path.abspath(path.dirname(__file__))
with open(path.join(here, file_name), encoding="utf-8") as f:
return f.read()
long_description = read_file("README.md")
version = re.sub("\s+", ... | 1.648438 | 2 |
integrationtest/vm/virt_plus/capacity/test_remove_host_check_ps_capacity_eq_0.py | bgerxx/woodpecker | 0 | 55698 | <reponame>bgerxx/woodpecker
'''
New Integration Test for SMP ps remove host and check ps capacity equal 0.
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource... | 1.679688 | 2 |
nocloud/cloud_init/models/vendor_data.py | chong601/NoCloud | 14 | 55699 | <gh_stars>10-100
from abc import ABC
from passlib.hash import <PASSWORD>512_crypt
from .base_generator import BaseGenerator
class VendorDataGenerator(BaseGenerator, ABC):
def __init__(self, password, hostname, require_update=True, require_upgrade=True, require_reboot=True):
self.password = <PASSWORD>(pas... | 2.46875 | 2 |