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 |
|---|---|---|---|---|---|---|
ui_mant_libros.py | edzzn/Manejo_Liberia | 0 | 3100 | from PyQt4 import QtGui
from ui_mant_libros_new import NewLibrosWindow
from ui_mant_libros_edit import EditLibrosWindow
from ui_mant_libros_id_edit import GetIdEditWindow
# Debug only
import inspect
class MenuLibros(QtGui.QWidget):
"""
Ventana-menu para editar Libros
"""
def __init__(self):
... | 2.28125 | 2 |
env/gym_poker_ai/envs/tests/holdem_calc/holdem_argparser.py | MrStonkus/PokerAi | 0 | 3101 | <reponame>MrStonkus/PokerAi<gh_stars>0
import argparse
import re
import holdem_calc.holdem_functions as holdem_functions
# Wrapper class which holds the arguments for library calls
# Mocks actual argparse object
class LibArgs:
def __init__(self, board, exact, num, input_file, hole_cards):
self.board = boa... | 3.296875 | 3 |
qbay/controllers.py | KarlDorogy/Cisc-327-Course-Project-Group-20 | 0 | 3102 | from flask import render_template, request, session, redirect
from qbay.models import *
from datetime import date
from qbay import app
def authenticate(inner_function):
"""
:param inner_function: any python function that accepts a user object
Wrap any python function and check the current session to see ... | 3.484375 | 3 |
gbfs/serializers.py | stadtulm/cykel | 80 | 3103 | <gh_stars>10-100
from datetime import timedelta
from django.utils.timezone import now
from preferences import preferences
from rest_framework import fields, serializers
from bikesharing.models import Bike, Station, VehicleType
from cykel.serializers import EnumFieldSerializer
class TimestampSerializer(fields.CharFi... | 2.140625 | 2 |
anime_downloader/extractors/vidstream.py | ngomile/anime-downloader | 2 | 3104 | import logging
import re
from anime_downloader.extractors.base_extractor import BaseExtractor
from anime_downloader.sites import helpers
logger = logging.getLogger(__name__)
class VidStream(BaseExtractor):
def _get_data(self):
QUALITIES = {
"360":[],
"480":[],
"720":[],
"10... | 2.71875 | 3 |
gui/sum_v1/views.py | time-crunched/nlp-toolbox | 0 | 3105 | <filename>gui/sum_v1/views.py
import time
import os
from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.views import View
from django.conf import settings
from .forms import File_uploadForm
from .models import File_upload, SummaryRes
from sim_v1.textsummary import TEXTSumm... | 2.171875 | 2 |
homeassistant/components/websocket_api/__init__.py | dannyqwertz/home-assistant | 4 | 3106 | <reponame>dannyqwertz/home-assistant
"""
Websocket based API for Home Assistant.
For more details about this component, please refer to the documentation at
https://developers.home-assistant.io/docs/external_api_websocket.html
"""
from homeassistant.core import callback
from homeassistant.loader import bind_hass
from... | 2.203125 | 2 |
test_app/settings.py | Lenders-Cooperative/Django-DocuSign | 0 | 3107 | <reponame>Lenders-Cooperative/Django-DocuSign<filename>test_app/settings.py
#
# Created on Tue Dec 21 2021
#
# Copyright (c) 2021 Lenders Cooperative, a division of Summit Technology Group, Inc.
#
"""
Django settings for test_app project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more informati... | 1.710938 | 2 |
tests/unit/ppr/test_search_query.py | doug-lovett/test-schemas-dl | 0 | 3108 | # Copyright © 2020 Province of British Columbia
#
# 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 law or agr... | 2.03125 | 2 |
devopsipy/decorators.py | kharnam/devopsipy | 0 | 3109 | """
Module to contain Pywork decorators
"""
__author__ = '<NAME>'
import re
import time
import itertools
import logging
log = logging.getLogger(__name__)
| 2.375 | 2 |
tests/test_decorators.py | stephenfin/django-rest-framework | 1 | 3110 | from __future__ import unicode_literals
import pytest
from django.test import TestCase
from rest_framework import status
from rest_framework.authentication import BasicAuthentication
from rest_framework.decorators import (
action, api_view, authentication_classes, detail_route, list_route,
parser_classes, per... | 2.1875 | 2 |
tamilmorse/morse_encode.py | CRE2525/open-tamil | 1 | 3111 | <reponame>CRE2525/open-tamil<filename>tamilmorse/morse_encode.py
## -*- coding: utf-8 -*-
#(C) 2018 <NAME>
# This file is part of Open-Tamil project
# You may use or distribute this file under terms of MIT license
import codecs
import json
import tamil
import sys
import os
#e.g. python morse_encode.py கலைஞர்
CURRDIR ... | 2.703125 | 3 |
Leetcode/Python/_1721.py | Xrenya/algorithms | 0 | 3112 | <filename>Leetcode/Python/_1721.py<gh_stars>0
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapNodes(self, head: Optional[ListNode], k: int) -> Optional[ListNode]:
temp = head
... | 3.75 | 4 |
contrib/functional_tests/functional/test_reorg.py | electrumsv/electrumsv | 136 | 3113 | <reponame>electrumsv/electrumsv<filename>contrib/functional_tests/functional/test_reorg.py
"""
Warning - this will reset all components back to a blank state before running the simulation
Runs node1, electrumx1 and electrumsv1 and loads the default wallet on the daemon (so that newly
submitted blocks will be synchroni... | 2.078125 | 2 |
Pyrado/pyrado/environments/mujoco/wam_bic.py | KhanhThiVo/SimuRLacra | 0 | 3114 | # Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code mus... | 1.101563 | 1 |
pyRasp.py | ToninoTarsi/pyRasp | 0 | 3115 | # pyRasp
# Copyright (c) <NAME> 2020. Licensed under MIT.
# requirement :
# Python 3
# pip install pyyaml
# pip install request
# pip install f90nml
from downloadGFSA import downloadGFSA
from prepare_wps import prepare_wps
from ungrib import ungrib
from metgrid import metgrid
from prepare_wrf import prepare_wrf
fro... | 1.617188 | 2 |
app/strategies/ema_bb_alligator_strategy.py | namuan/crypto-rider | 1 | 3116 | import pandas as pd
import ta
from app.common import reshape_data
from app.strategies.base_strategy import BaseStrategy
pd.set_option("display.max_columns", None)
pd.set_option("display.width", None)
class EMABBAlligatorStrategy(BaseStrategy):
BUY_SIGNAL = "buy_signal"
SELL_SIGNAL = "sell_signal"
def c... | 2.46875 | 2 |
BasicScripts/basics.py | TomasBelskis/PythonAutomation | 0 | 3117 | # Python Basics
# String concatenaton
added_strings = str(32) + "_342"
# Getting input
input_from_user = input()
# Basic print function
print(input_from_user)
# Mixing boolean and comparison operations
if (4 < 5) and (5 < 6):
print("True")
# Basic if & if else flow
if name == 'Alice':
print('Hi, Alice.')... | 4 | 4 |
env.example.py | wilcoln/klazor | 8 | 3118 | <filename>env.example.py
DATABASE_OPTIONS = {
'database': 'klazor',
'user': 'root',
'password': '',
'charset': 'utf8mb4',
}
HOSTS = ['127.0.0.1', '172.16.58.3']
| 1.34375 | 1 |
misc/_local_settings.py | lzantal/djskell | 4 | 3119 | <gh_stars>1-10
"""
Django settings.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
#DEBUG = False
DE... | 1.328125 | 1 |
contacts/forms.py | pedrohd21/Agenda-Django | 1 | 3120 | <gh_stars>1-10
from django import forms
from .models import Contact
class ContactForm(forms.ModelForm):
class Meta:
model = Contact
fields = ('name', 'number', 'email', 'category', 'description')
| 2.140625 | 2 |
awx/api/urls/ad_hoc_command.py | ziegenberg/awx | 0 | 3121 | <reponame>ziegenberg/awx<filename>awx/api/urls/ad_hoc_command.py
# Copyright (c) 2017 Ansible, Inc.
# All Rights Reserved.
from django.urls import re_path
from awx.api.views import (
AdHocCommandList,
AdHocCommandDetail,
AdHocCommandCancel,
AdHocCommandRelaunch,
AdHocCommandAdHocCommandEventsList,... | 1.929688 | 2 |
note5/package_test5.py | icexmoon/python-learning-notes | 0 | 3122 | #test.py
from time_tools import *
# print(compareTimestamp(111,222))
time.showNowTime()
# now time is XX:XX:XX | 2.5 | 2 |
fgarcade/sprites.py | fabiommendes/fgarcade | 2 | 3123 | <gh_stars>1-10
import arcade
from arcade import FACE_RIGHT, FACE_DOWN, FACE_UP, FACE_LEFT
class AnimatedWalkingSprite(arcade.Sprite):
def __init__(self, scale: float = 1,
image_x: float = 0, image_y: float = 0,
center_x: float = 0, center_y: float = 0, *,
stand_l... | 2.578125 | 3 |
src/mafUtility.py | gh-schen/SiriusEpiClassifier | 1 | 3124 | <filename>src/mafUtility.py<gh_stars>1-10
from numpy.core.fromnumeric import transpose
from sklearn import linear_model
from scipy.special import logit
from scipy import stats
from copy import deepcopy
from numpy import random, concatenate, quantile, matmul, transpose
import logging
class singleRegModel():
"""
... | 2.515625 | 3 |
examples/linreg.py | hanyas/sds | 12 | 3125 | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.linear_model import ARDRegression, LinearRegression
# Parameters of the example
np.random.seed(0)
n_samples, n_features = 100, 100
# Create Gaussian data
X = np.random.randn(n_samples, n_features)
# Create weights with a precision... | 2.875 | 3 |
optimal/tompkins/examples/dask_scheduling_problem_nonetcontention.py | KarizCache/serverless | 0 | 3126 | #!/usr/bin/python3
import os
import json
import re
import ast
import json
from graphviz import Digraph
import pandas as pd
# color the graph
import graph_tool.all as gt
import copy
import matplotlib.colors as mcolors
import sys
import utils
from tompkins.ilp import schedule, jobs_when_where
from collections import d... | 2.109375 | 2 |
tests/apitests/python/test_robot_account.py | gerhardgossen/harbor | 1 | 3127 | from __future__ import absolute_import
import unittest
from testutils import ADMIN_CLIENT
from testutils import TEARDOWN
from library.user import User
from library.project import Project
from library.repository import Repository
from library.repository import pull_harbor_image
from library.repository import push_imag... | 2.25 | 2 |
slackchannel2pdf/locales.py | ErikKalkoken/slackchannel2pdf | 52 | 3128 | import datetime as dt
import logging
from babel import Locale, UnknownLocaleError
from babel.dates import format_datetime, format_time, format_date
import pytz
from tzlocal import get_localzone
from . import settings
logger = logging.getLogger(__name__)
class LocaleHelper:
"""Helpers for converting date & tim... | 2.71875 | 3 |
databoard/databoard/default_config.py | glemaitre/ramp-board-1 | 0 | 3129 | <reponame>glemaitre/ramp-board-1<gh_stars>0
import os
class Config(object):
# FLASK GENERAL CONFIG PARAMETERS
SECRET_KEY = os.getenv('DATABOARD_SECRET_KEY', '<KEY>')
# abs max upload file size, to throw 413, before saving it
WTF_CSRF_ENABLED = True
LOG_FILENAME = None # if None, output to screen
... | 1.90625 | 2 |
python_developer_tools/cv/bases/pool/AvgPool2d.py | carlsummer/python_developer_tools | 32 | 3130 | <filename>python_developer_tools/cv/bases/pool/AvgPool2d.py
# !/usr/bin/env python
# -- coding: utf-8 --
# @Author zengxiaohui
# Datatime:8/31/2021 1:37 PM
# @File:GlobalAvgPool2d
import torch.nn as nn
from python_developer_tools.cv.bases.activates.swish import h_swish
class GlobalAvgPool2d(nn.Module):
""" Fast ... | 2.453125 | 2 |
expyfun/_utils.py | nordme/expyfun | 2 | 3131 | <filename>expyfun/_utils.py
"""Some utility functions"""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import warnings
import operator
from copy import deepcopy
import subprocess
import importlib
import os
import os.path as op
import inspect
import sys
import tempfile
import ssl
from shutil import rmtree
im... | 2.03125 | 2 |
mixin.py | delimatorres/foodbasket | 0 | 3132 | import signal
class KillableProcess(object):
def __init__(self):
self.interrupt = False
signal.signal(signal.SIGTERM, self._signal_handler)
signal.signal(signal.SIGINT, self._signal_handler)
def _signal_handler(self, sign, frame):
self.interrupt = True | 2.34375 | 2 |
test5.py | liubaishuo-github/peening-post-processor | 0 | 3133 | def HAHA():
return 1,2,3
a = HAHA()
print(a)
print(a[0])
| 2.734375 | 3 |
torch/_fx/graph_module.py | jsun94/nimble | 206 | 3134 | <gh_stars>100-1000
import torch
import torch.overrides
import linecache
from typing import Type, Dict, List, Any, Union
from .graph import Graph
import copy
# normal exec loses the source code, however we can patch
# the linecache module to still recover it.
# using exec_with_source will add it to our local cache
# an... | 2.34375 | 2 |
RequestHandler.py | robot0nfire/behem0th | 2 | 3135 | #
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, ... | 1.976563 | 2 |
tests/utils/test_metrics.py | haochuanwei/hover | 251 | 3136 | <filename>tests/utils/test_metrics.py<gh_stars>100-1000
from hover.utils.metrics import classification_accuracy
import numpy as np
def test_classification_accuracy():
true = np.array([1, 2, 3, 4, 5, 6, 7, 7])
pred = np.array([1, 2, 3, 4, 5, 6, 7, 8])
accl = classification_accuracy(true, pred)
accr = cl... | 1.976563 | 2 |
scripts/blenderseed.package.py | rgirish28/blenderseed | 0 | 3137 | <filename>scripts/blenderseed.package.py
#!/usr/bin/python
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2017-2018 <NAME>, The appleseedhq Organization
#
# Permission is hereby... | 1.179688 | 1 |
uts/uts_17_aut_py/2/A.py | viad00/code_olymp | 0 | 3138 | <filename>uts/uts_17_aut_py/2/A.py
ser = int(input())
mas = list(map(int, input().split()))
mas.sort()
print(*mas)
| 2.3125 | 2 |
wagtailkatex/wagtail_hooks.py | ongchi/wagtail-katex | 0 | 3139 | from django.utils.translation import gettext
from wagtail.admin.rich_text.editors.draftail import features as draftail_features
from wagtail.core import hooks
from .richtext import KaTeXEntityElementHandler, katex_entity_decorator
@hooks.register('register_rich_text_features')
def register_katex_features(features):... | 1.96875 | 2 |
esque_wire/protocol/serializers/api/elect_preferred_leaders_request.py | real-digital/esque-wire | 0 | 3140 | ###############################################################
# Autogenerated module. Please don't modify. #
# Edit according file in protocol_generator/templates instead #
###############################################################
from typing import Dict
from ...structs.api.elect_preferred_le... | 1.601563 | 2 |
test/tests/bootstrap/test_api20_windows_bootstrap.py | arunrordell/RackHD | 451 | 3141 | '''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
This script tests arbitrary payload of the RackHD API 2.0 OS bootstrap workflows.
The default case is running a minimum payload Windows OS install.
Other Windows-type OS install cases can be specified by creating a payload file and specifiying it u... | 2.203125 | 2 |
random_number.py | till-h/alexa | 0 | 3142 | from flask import Flask, render_template
from flask_ask import Ask, statement
import random
app = Flask(__name__)
ask = Ask(app, '/')
@ask.intent('RandomNumber', convert={'lowerLimit': int, 'upperLimit': int})
def hello(lowerLimit, upperLimit):
if lowerLimit == None:
lowerLimit = 0
if upperLimit == None:
upperL... | 2.890625 | 3 |
model/losses.py | askerlee/rift | 11 | 3143 | <reponame>askerlee/rift
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from model.laplacian import LapLoss
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class EPE(nn.Module):
def __init__(self):
super(EPE, ... | 2.296875 | 2 |
project/python/swarm_simulation.py | righetti/swarmrobotics | 8 | 3144 | import numpy as np
import pybullet as p
import itertools
from robot import Robot
class World():
def __init__(self):
# create the physics simulator
self.physicsClient = p.connect(p.GUI)
p.setGravity(0,0,-9.81)
self.max_communication_distance = 2.0
# We will int... | 2.5 | 2 |
boto/ec2/elb/__init__.py | wt/boto | 15 | 3145 | <gh_stars>10-100
# Copyright (c) 2006-2012 <NAME> http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# 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 S... | 1.875 | 2 |
basis_set_exchange/cli/bse_cli.py | atomse/basis_set_exchange | 0 | 3146 | <reponame>atomse/basis_set_exchange
'''
Command line interface for the basis set exchange
'''
import argparse
import argcomplete
from .. import version
from .bse_handlers import bse_cli_handle_subcmd
from .check import cli_check_normalize_args
from .complete import (cli_case_insensitive_validator,
... | 2.109375 | 2 |
Backjoon/1929.py | hanjungwoo1/CodingTest | 3 | 3147 | """
입력 예시
3 16
출력 예시
3
5
7
11
13
"""
import math
left, right = map(int, input().split())
array = [True for i in range(right+1)]
array[1] = 0
for i in range(2, int(math.sqrt(right)) + 1):
if array[i] == True:
j = 2
while i * j <= right:
array[i * j] = False
j += 1
for i in... | 3.390625 | 3 |
tensorflow/tools/quantization/quantize_graph_test.py | tianyapiaozi/tensorflow | 374 | 3148 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | 2.078125 | 2 |
layerserver/migrations/0001_initial.py | aroiginfraplan/giscube-admin | 5 | 3149 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-26 09:14
import colorfield.fields
from django.db import migrations, models
import django.db.models.deletion
import giscube.utils
class Migration(migrations.Migration):
initial = True
dependencies = [
('giscube', '0002_update'),
]... | 1.726563 | 2 |
SETTINGS.py | pirica/fortnite-leaks-image-generator | 5 | 3150 | <filename>SETTINGS.py
backgroundurl = "https://storage.needpix.com/rsynced_images/colored-background.jpg" # <- Need to be a Image URL!!!
lang = "en" # <- language code
displayset = True # <- Display the Set of the Item
raritytext = True # <- Display the Rarity of the Item
typeconfig = {
"BannerToken": True,... | 2.203125 | 2 |
src/healthvaultlib/tests/testbase.py | rajeevs1992/pyhealthvault | 1 | 3151 | <filename>src/healthvaultlib/tests/testbase.py
import unittest
import settings
from healthvaultlib.helpers.connection import Connection
class TestBase(unittest.TestCase):
def setUp(self):
self.connection = self.get_connection()
def get_connection(self):
conn = Connection(settings.HV_... | 2.234375 | 2 |
apps/extensions/migrations/0012_imports_path_urlfield_to_charfield.py | StepicOrg/stepik-apps | 5 | 3152 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-09 03:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extensions', '0011_auto_20170502_0908'),
]
operations = [
migrations.AlterF... | 1.40625 | 1 |
regtests/bench/thread_collision.py | secureosv/pythia | 17 | 3153 | '''
multi-threading (python3 version)
https://docs.python.org/3/library/threading.html
'''
from time import clock
import threading
THREADS=2
lock = threading.Lock()
A = 0
B = 0
C = 0
def test_globals():
global A, B, C
for i in range(1024*1024):
lock.acquire()
A += 1
B += 2
C = A + B
lock.release()
def... | 3.765625 | 4 |
game/board.py | scooler/checkers | 0 | 3154 | import numpy as np
class Board:
"""
0 - black
1 - white
"""
def __init__(self):
board = [
[0, 1] * 4,
[1, 0] * 4
] * 4
players_board = [
[0, 1] * 4, # player 1
[1, 0] * 4
] + [[0] * 8] * 4 + [ # 4 rows of nothing
[0, 2] * 4, # player 2
[2, 0] * 4
]
se... | 3.546875 | 4 |
utils/get_season_things_price.py | vogelfenx/storagebot | 0 | 3155 | def get_season_things_price(thing, amount, price):
if thing == 'wheel':
wheel_price = price[thing]['month'] * amount
return f'Стоимость составит {wheel_price}/месяц'
else:
other_thing_price_week = price[thing]['week'] * amount
other_thing_price_month = price[thing]['month'] * a... | 3.453125 | 3 |
zge/engine.py | zhester/zge | 0 | 3156 | <reponame>zhester/zge
"""
Zoe Game Engine Core Implementation
===================================
Requirements
------------
[pygame](http://www.pygame.org/)
"""
# core packages
# third-party packages
import pygame
# local package
import layer
__version__ = '0.0.0'
#=============================================... | 2.96875 | 3 |
Authentication/migrations/0004_auto_20201115_1105.py | CHESyrian/Estebyan | 0 | 3157 | <filename>Authentication/migrations/0004_auto_20201115_1105.py
# Generated by Django 3.0.6 on 2020-11-15 09:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Authentication', '0003_auto_20201113_2210'),
]
operations = [
migrations.Alte... | 1.34375 | 1 |
dashboard/urls.py | EdisonBr/MockDados | 0 | 3158 | <filename>dashboard/urls.py
from django.urls import path, re_path
from django.views.generic.base import TemplateView
from .views import dashboard_cost, dashboard_energy, MotorDataListView
app_name = 'dashboard'
urlpatterns = [
path('', MotorDataListView.as_view(), name='dashboard_custom'),
#path('', dash... | 1.84375 | 2 |
Coursera/Python for Everybody Specialization/Python for everybody basics/hourly rate.py | ejgarcia1991/Courses-and-other-non-professional-projects | 1 | 3159 | hrs = input("Enter Hours:")
rate = input("Enter rate:")
pay = float(hrs) * float(rate)
print("Pay: " +str(pay)) | 3.796875 | 4 |
litex_boards/platforms/xilinx_kcu105.py | smunaut/litex-boards | 177 | 3160 | #
# This file is part of LiteX-Boards.
#
# Copyright (c) 2017-2019 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import *
from litex.build.xilinx import XilinxPlatform, VivadoProgrammer
# IOs ---------------------------------------------------------------------------------... | 1.34375 | 1 |
code/advent_of_code_day3.py | erinleeryan/2020adventofcode | 0 | 3161 | <gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import math
# In[2]:
fileObj = open('../data/advent_of_code_input_day_three.txt', "r") #opens the file in read mode.
items = fileObj. read(). splitlines() #puts the file into an array.
# In[3]:
#print (items)
def split(line):
... | 3.375 | 3 |
input_handler.py | Wyverns010/Body-Keypoints-Detection | 1 | 3162 | import os
import traceback
class InputHandler:
IMAGES_PARENT_FOLDER = './images'
def __init__(self):
filesList = []
def listFiles(self,path=''):
if path != '':
self.IMAGES_PARENT_FOLDER = path
try:
self.listFiles = [os.path.join(self.IMAGES_PAREN... | 3.109375 | 3 |
docker/autoconfig.py | misc0110/bepasty-server | 0 | 3163 | <filename>docker/autoconfig.py
#!/usr/bin/python
import os
import sys
SITENAME = os.environ.get("BEPASTY_SITENAME", None)
if SITENAME is None:
print("\n\nEnvironment variable BEPASTY_SITENAME must be set.")
sys.exit(1)
SECRET_KEY = os.environ.get("BEPASTY_SECRET_KEY", None)
if SECRET_KEY is None:
print("... | 2.265625 | 2 |
pysh/transforms/alpha/bangexpr.py | drslump/pysh | 3 | 3164 | <reponame>drslump/pysh
from io import StringIO
import re
import tokenize
import os
from collections import deque, ChainMap
from functools import lru_cache
from enum import Enum
import pysh
from pysh.path import PathWrapper, Path
from typing import List, Callable, Iterator, Tuple, NamedTuple, Deque, Union, Any
TBangTr... | 2.25 | 2 |
example/bayesian-methods/data_loader.py | Vikas-kum/incubator-mxnet | 54 | 3165 | <gh_stars>10-100
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License... | 1.9375 | 2 |
start.py | mickeyckm/nanodegree-freshtomatoes | 1 | 3166 | import os
import tmdbsimple as tmdb
import media
import fresh_tomatoes as ft
movies = []
if os.environ.get('TMDB_API', False):
# Retrieve API KEY
tmdb.API_KEY = os.environ['TMDB_API']
# TMDB Movie Ids
movie_ids = [271110, 297761, 246655, 278154, 135397, 188927]
# Get Configuration
configurat... | 2.59375 | 3 |
qiskit_metal/_gui/elements_ui.py | sarafs1926/qiskit-metal | 1 | 3167 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './elements_ui.ui',
# licensing of './elements_ui.ui' applies.
#
# Created: Wed Jun 16 14:29:03 2021
# by: pyside2-uic running on PySide2 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui... | 1.40625 | 1 |
Python/function.py | manishaverma1012/programs | 0 | 3168 | def cube(number):
return number*number*number
digit = input(" the cube of which digit do you want >")
result = cube(int(digit))
print(result)
| 4.0625 | 4 |
tests/test_runner.py | elifesciences/proofreader-python | 1 | 3169 | <reponame>elifesciences/proofreader-python<gh_stars>1-10
try:
from unittest.mock import patch
except ImportError: # pragma: no cover
from mock import patch
from proofreader.runner import run, _run_command
def test_it_will_return_1_exit_code_on_failure(bad_py_file):
try:
run(targets=[bad_py_file.... | 2.671875 | 3 |
tanim/core/container/container.py | wofeicaoge/Tanim | 0 | 3170 | from tanim.utils.config_ops import digest_config
from tanim.utils.iterables import list_update
# Currently, this is only used by both Scene and Mobject.
# Still, we abstract its functionality here, albeit purely nominally.
# All actual implementation has to be handled by derived classes for now.
class Container(obj... | 2.46875 | 2 |
article.py | ZACHSTRIVES/AUCSS-StaffPlatform | 3 | 3171 | from config import *
def fetch_all_article():
try:
cur = db.cursor()
sql = "SELECT * FROM article WHERE article_status='N'"
db.ping(reconnect=True)
cur.execute(sql)
result = cur.fetchall()
db.commit()
cur.close()
return result
except Exception as... | 2.953125 | 3 |
12-Querying-Data-II/just_filtering.py | dwang-ischool/w205 | 23 | 3172 | <reponame>dwang-ischool/w205<gh_stars>10-100
#!/usr/bin/env python
"""Extract events from kafka and write them to hdfs
"""
import json
from pyspark.sql import SparkSession, Row
from pyspark.sql.functions import udf
@udf('boolean')
def is_purchase(event_as_json):
event = json.loads(event_as_json)
if event['eve... | 2.65625 | 3 |
test.py | navjotk/pysz | 3 | 3173 | import numpy as np
from pysz import compress, decompress
def test_compress_decompress():
a = np.linspace(0, 100, num=1000000).reshape((100, 100, 100)).astype(np.float32)
tolerance = 0.0001
compressed = compress(a, tolerance=tolerance)
recovered = decompress(compressed, a.shape, a.dtype)
asse... | 2.46875 | 2 |
sparkdq/outliers/params/KSigmaParams.py | PasaLab/SparkDQ | 1 | 3174 | import json
from sparkdq.outliers.params.OutlierSolverParams import OutlierSolverParams
from sparkdq.outliers.OutlierSolver import OutlierSolver
class KSigmaParams(OutlierSolverParams):
def __init__(self, deviation=1.5):
self.deviation = deviation
def model(self):
return OutlierSolver.kSigm... | 2.453125 | 2 |
webhooks/sentry/alerta_sentry.py | dunzoit/alerta-contrib | 0 | 3175 | <reponame>dunzoit/alerta-contrib
from alerta.models.alert import Alert
from alerta.webhooks import WebhookBase
class SentryWebhook(WebhookBase):
def incoming(self, query_string, payload):
# For Sentry v9
# Defaults to value before Sentry v9
if 'request' in payload.get('event'):
... | 2.078125 | 2 |
XMLHttpRequest/resources/shift-jis-html.py | watilde/web-platform-tests | 4 | 3176 | def main(request, response):
headers = [("Content-type", "text/html;charset=shift-jis")]
# Shift-JIS bytes for katakana TE SU TO ('test')
content = chr(0x83) + chr(0x65) + chr(0x83) + chr(0x58) + chr(0x83) + chr(0x67);
return headers, content
| 2.15625 | 2 |
setup.py | dolfim/django-mail-gmailapi | 0 | 3177 | import re
from setuptools import setup, find_packages
import sys
if sys.version_info < (3, 5):
raise 'must use Python version 3.5 or higher'
with open('./gmailapi_backend/__init__.py', 'r') as f:
MATCH_EXPR = "__version__[^'\"]+(['\"])([^'\"]+)"
VERSION = re.search(MATCH_EXPR, f.read()).group(2).strip()
... | 1.539063 | 2 |
openpeerpower/scripts/ensure_config.py | OpenPeerPower/openpeerpower | 0 | 3178 | """Script to ensure a configuration file exists."""
import argparse
import os
import openpeerpower.config as config_util
from openpeerpower.core import OpenPeerPower
# mypy: allow-untyped-calls, allow-untyped-defs
def run(args):
"""Handle ensure config commandline script."""
parser = argparse.ArgumentParser... | 3 | 3 |
atcoder/abc132A_fifty_fifty.py | uninhm/kyopro | 31 | 3179 | # Vicfred
# https://atcoder.jp/contests/abc132/tasks/abc132_a
# implementation
S = list(input())
if len(set(S)) == 2:
if S.count(S[0]) == 2:
print("Yes")
quit()
print("No")
| 3.46875 | 3 |
dabl/plot/tests/test_supervised.py | nrohan09-cloud/dabl | 500 | 3180 | <reponame>nrohan09-cloud/dabl<gh_stars>100-1000
import pytest
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import itertools
from sklearn.datasets import (make_regression, make_blobs, load_digits,
fetch_openml, load_diabetes)
from sklearn.preprocessing import KBi... | 2.484375 | 2 |
scripts/calculate_rank.py | daniel-theis/multicore-test-harness | 15 | 3181 | <reponame>daniel-theis/multicore-test-harness
################################################################################
# Copyright (c) 2017 <NAME>, <NAME>, <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... | 1.53125 | 2 |
contrib/antlrqueryparser/src/python/generate_asts.py | marblestation/montysolr | 24 | 3182 |
import sys
import subprocess as sub
import os
"""
Simple utility script to generate HTML charts of how ANTLR parses
every query and what is the resulting AST.
"""
def run(grammar_name, basedir='',
cp='.:/dvt/antlr-142/lib/antlr-3.4-complete.jar:/x/dev/antlr-34/lib/antlr-3.4-complete.jar',
grammardi... | 2.78125 | 3 |
visual_perception/Detection/yolov4/__init__.py | SSusantAchary/Visual-Perception | 0 | 3183 | <reponame>SSusantAchary/Visual-Perception
"""
MIT License
Copyright (c) 2020 <NAME> <<EMAIL>>
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... | 1.296875 | 1 |
server/mqtt/handler.py | rishab-rb/MyIOTMap | 1 | 3184 | <reponame>rishab-rb/MyIOTMap
import paho.client as mqtt
HOST = 'localhost'
PORT = 1883
class MQTTConnector:
def __init__(self, host, port):
host = host
port = port
client = mqtt.Client()
def connect():
self.client.connect(self.host, self.port, 60)
def run(sel... | 2.71875 | 3 |
scripts/spacy_files/similarity_replacement.py | HighDeFing/thesis_v4 | 0 | 3185 | #!/bin/env python
from black import main
import spacy
import json
from spacy import displacy
import unidecode
import pandas as pd
import numpy as np
import os
csv_source = "scripts/spacy_files/data/thesis_200_with_school.csv"
df = pd.read_csv(csv_source)
df = df[df['isScan']==False]
df = df.sort_values('isScan', asce... | 3.09375 | 3 |
test/unittest_base.py | dat-boris/tensorforce | 0 | 3186 | <filename>test/unittest_base.py
# Copyright 2018 Tensorforce Team. All Rights Reserved.
#
# 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
#
# ... | 2.1875 | 2 |
mspray/apps/reveal/__init__.py | onaio/mspray | 0 | 3187 | """init module for reveal app"""
# pylint: disable=invalid-name
default_app_config = "mspray.apps.reveal.apps.RevealConfig" # noqa
| 1.210938 | 1 |
guifw/models/port.py | luizerico/PyGuiFW | 1 | 3188 | from django.db import models
from django import forms
from audit_log.models.managers import AuditLog
# Create your models here.
class Port(models.Model):
name = models.CharField(max_length=250)
port = models.CharField(max_length=250)
description = models.TextField(blank=True)
audit_log = AuditLog()... | 2.078125 | 2 |
app/backend/arm/migrations/0002_auto_20190924_1712.py | karstenv/nmp-arm | 2 | 3189 | <reponame>karstenv/nmp-arm
# Generated by Django 2.2.5 on 2019-09-25 00:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('arm', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='CautionMessage',
... | 1.367188 | 1 |
webcam_demo.py | taranek/tennis-stats-provider | 0 | 3190 | import tensorflow as tf
import json
import math
import cv2
import time
import argparse
import concurrent.futures
import posenet
import keyboard
import sys
import numpy as np
from threading import Thread
from slugify import slugify
parser = argparse.ArgumentParser()
parser.add_argument('--model', type=int, default=101)... | 2.234375 | 2 |
otcextensions/tests/unit/osclient/dcs/v1/fakes.py | zsoltn/python-otcextensions | 0 | 3191 | # 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 law or agreed to in writing, software
# distrib... | 1.898438 | 2 |
tests/dummy_repo/tvm/python/tvm/api.py | csullivan/ffi-navigator | 148 | 3192 | from ._ffi.base import string_types
from ._ffi.object import register_object, Object
from ._ffi.node import register_node, NodeBase
from ._ffi.node import convert_to_node as _convert_to_node
from ._ffi.node_generic import _scalar_type_inference
from ._ffi.function import Function
from ._ffi.function import _init_api, r... | 1.679688 | 2 |
torchattacks/attacks/multiattack.py | Harry24k/adversarial-attacks-pytorch | 782 | 3193 | <filename>torchattacks/attacks/multiattack.py
import copy
import torch
from ..attack import Attack
class MultiAttack(Attack):
r"""
MultiAttack is a class to attack a model with various attacks agains same images and labels.
Arguments:
model (nn.Module): model to attack.
attacks (list): l... | 3.171875 | 3 |
src/manager/om/script/gspylib/inspection/items/os/CheckPortConflict.py | wotchin/openGauss-server | 1 | 3194 | # -*- coding:utf-8 -*-
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE... | 2.046875 | 2 |
_scripts/_build.py | dfreeman06/wxyz | 1 | 3195 | import subprocess
import sys
from . import ROOT, PY_SRC, _run, PY, DIST
CONDA_ORDER = [
"core",
"html",
"lab",
"datagrid",
"svg",
"tpl-jjinja"
"yaml"
]
CONDA_BUILD_ARGS = [
"conda-build", "-c", "conda-forge", "--output-folder", DIST / "conda-bld",
]
if __name__ == "__main__":
f... | 1.726563 | 2 |
scripts/C189/C189Checkin.py | xiaopowanyi/py_scripts | 2 | 3196 | <gh_stars>1-10
import requests, time, re, rsa, json, base64
from urllib import parse
s = requests.Session()
username = ""
password = ""
if(username == "" or password == ""):
username = input("账号:")
password = input("密码:")
def main():
login(username, password)
rand = str(round(time.time()*1000))
... | 2.515625 | 3 |
Mmint/CGratio.py | lijiacd985/Mplot | 5 | 3197 | import subprocess
from .Genome_fasta import get_fasta
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
import pysam
def run(parser):
args = parser.parse_args()
bases,chrs = get_fasta(args.genome)
l={}
for c in chrs:
l[c]=len(bases[c])
chrs = se... | 2.328125 | 2 |
src/furo/__init__.py | sethmlarson/furo | 0 | 3198 | <reponame>sethmlarson/furo<filename>src/furo/__init__.py
"""A clean customisable Sphinx documentation theme."""
__version__ = "2020.9.8.beta2"
from pathlib import Path
from .body import wrap_tables
from .code import get_pygments_style_colors
from .navigation import get_navigation_tree
from .toc import should_hide_to... | 2.015625 | 2 |
experiments/mix_down.py | fretboardfreak/potty_oh | 0 | 3199 | #!/usr/bin/env python3
# Copyright 2016 <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 law or ... | 2.78125 | 3 |