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 |
|---|---|---|---|---|---|---|
testing/conftest.py | davidszotten/pdbpp | 0 | 4300 | import functools
import sys
from contextlib import contextmanager
import pytest
_orig_trace = None
def pytest_configure():
global _orig_trace
_orig_trace = sys.gettrace()
@pytest.fixture(scope="session", autouse=True)
def term():
"""Configure TERM for predictable output from Pygments."""
from _pyt... | 2.078125 | 2 |
thing_gym_ros/envs/utils.py | utiasSTARS/thing-gym-ros | 1 | 4301 | <gh_stars>1-10
""" Various generic env utilties. """
def center_crop_img(img, crop_zoom):
""" crop_zoom is amount to "zoom" into the image. E.g. 2.0 would cut out half of the width,
half of the height, and only give the center. """
raw_height, raw_width = img.shape[:2]
center = raw_height // 2, raw_wid... | 2.96875 | 3 |
tests/sentry/utils/http/tests.py | arya-s/sentry | 1 | 4302 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from exam import fixture
from sentry import options
from sentry.models import Project
from sentry.testutils import TestCase
from sentry.utils.http import (
is_same_domain, is_valid_origin, get_origins, absolute_uri, is_val... | 2.265625 | 2 |
comcenterproject/project/helpers.py | tongpa/bantak_program | 0 | 4303 | <gh_stars>0
# -*- coding: utf-8 -*-
"""WebHelpers used in project."""
#from webhelpers import date, feedgenerator, html, number, misc, text
from markupsafe import Markup
def bold(text):
return Markup('<strong>%s</strong>' % text) | 1.757813 | 2 |
Thesis/load/runRiakLoads.py | arnaudsjs/YCSB-1 | 0 | 4304 | import sys;
from Thesis.load.loadBenchmark import runLoadBenchmarkAsBatch;
from Thesis.cluster.RiakCluster import RiakCluster;
NORMAL_BINDING = 'riak';
CONSISTENCY_BINDING = 'riak_consistency';
IPS_IN_CLUSTER = ['172.16.33.14', '172.16.33.15', '172.16.33.16', '172.16.33.17', '172.16.33.18'];
def main():
if len(s... | 2.0625 | 2 |
auto_nag/tests/test_round_robin.py | Mozilla-GitHub-Standards/f9c78643f5862cda82001d4471255ac29ef0c6b2c6171e2c1cbecab3d2fef4dd | 0 | 4305 | # coding: utf-8
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import unittest
from mock import patch
from auto_nag.people import People
from auto_nag.round_robin im... | 2.234375 | 2 |
scipy/weave/inline_tools.py | tacaswell/scipy | 1 | 4306 | # should re-write compiled functions to take a local and global dict
# as input.
from __future__ import absolute_import, print_function
import sys
import os
from . import ext_tools
from . import catalog
from . import common_info
from numpy.core.multiarray import _get_ndarray_c_version
ndarray_api_version = '/* NDARRA... | 2.296875 | 2 |
trove/guestagent/common/configuration.py | sapcc/trove | 1 | 4307 | <reponame>sapcc/trove
# Copyright 2015 Tesora Inc.
# 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
#
# ... | 1.851563 | 2 |
API-Reference-Code-Generator.py | sawyercade/Documentation | 116 | 4308 | import pathlib
import yaml
documentations = {"Our Platform": "QuantConnect-Platform-2.0.0.yaml",
"Alpha Streams": "QuantConnect-Alpha-0.8.yaml"}
def RequestTable(api_call, params):
writeUp = '<table class="table qc-table">\n<thead>\n<tr>\n'
writeUp += f'<th colspan="2"><code>{api_call}</code... | 2.296875 | 2 |
forge_api_client/hubs.py | dmh126/forge-python-data-management-api | 1 | 4309 | from .utils import get_request, authorized
class Hubs:
@authorized
def getHubs(self):
url = self.api_url + '/project/v1/hubs'
headers = {
'Authorization': '%s %s' % (self.token_type, self.access_token)
}
return get_request(url, headers)
@authorized
def g... | 2.578125 | 3 |
tlp/django_app/app/urls.py | munisisazade/create-django-app | 14 | 4310 | from django.conf.urls import url
# from .views import BaseIndexView
urlpatterns = [
# url(r'^$', BaseIndexView.as_view(), name="index"),
] | 1.445313 | 1 |
tools/archive/create_loadable_configs.py | madelinemccombe/iron-skillet | 0 | 4311 | <gh_stars>0
# Copyright (c) 2018, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTH... | 2.328125 | 2 |
pactman/verifier/pytest_plugin.py | piotrantosz/pactman | 67 | 4312 | import glob
import logging
import os
import warnings
import pytest
from _pytest.outcomes import Failed
from _pytest.reports import TestReport
from .broker_pact import BrokerPact, BrokerPacts, PactBrokerConfig
from .result import PytestResult, log
def pytest_addoption(parser):
group = parser.getgroup("pact speci... | 2.140625 | 2 |
interface/docstring.py | karttur/geoimagine02-grass | 0 | 4313 | # -*- coding: utf-8 -*-
def docstring_property(class_doc):
"""Property attribute for docstrings.
Took from: https://gist.github.com/bfroehle/4041015
>>> class A(object):
... '''Main docstring'''
... def __init__(self, x):
... self.x = x
... @docstring_property(__doc__)... | 2.765625 | 3 |
autocnet/matcher/cuda_matcher.py | gsn9/autocnet | 0 | 4314 | <reponame>gsn9/autocnet
import warnings
try:
import cudasift as cs
except:
cs = None
import numpy as np
import pandas as pd
def match(edge, aidx=None, bidx=None, **kwargs):
"""
Apply a composite CUDA matcher and ratio check. If this method is used,
no additional ratio check is necessary and no ... | 1.96875 | 2 |
app/apis/__init__.py | FabienArcellier/blueprint-webapp-flask-restx | 0 | 4315 | from flask_restx import Api
from app.apis.hello import api as hello
api = Api(
title='api',
version='1.0',
description='',
prefix='/api',
doc='/api'
)
api.add_namespace(hello)
| 2.046875 | 2 |
tests/test_core.py | Kantouzin/brainfuck | 0 | 4316 | <gh_stars>0
# coding: utf-8
import unittest
from test.support import captured_stdout
from brainfuck import BrainFuck
class TestCore(unittest.TestCase):
def test_hello_world(self):
bf = BrainFuck()
with captured_stdout() as stdout:
bf.run()
self.assertEqual(stdout.getvalue()... | 2.890625 | 3 |
main.py | poltavski/social-network-frontend | 0 | 4317 | from fastapi import FastAPI, Request, Response
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
from utils import get_page_data, process_initial
import uvicorn
app = FastAPI()
templates = Jinja2Templates(directory="templates")
app.mou... | 2.640625 | 3 |
Core/Python/create_static_group.py | Ku-Al/OpenManage-Enterprise | 0 | 4318 | <gh_stars>0
#
# Python script using OME API to create a new static group
#
# _author_ = <NAME> <<EMAIL>>
# _version_ = 0.1
#
# Copyright (c) 2020 Dell EMC Corporation
#
# 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... | 2.703125 | 3 |
examples/references/segmentation/pascal_voc2012/code/dataflow/dataloaders.py | kagrze/ignite | 0 | 4319 | <filename>examples/references/segmentation/pascal_voc2012/code/dataflow/dataloaders.py
from typing import Callable, Optional, Tuple, Union
import numpy as np
from torch.utils.data import DataLoader, Sampler
from torch.utils.data.dataset import Subset, ConcatDataset
import torch.utils.data.distributed as data_dist
fr... | 2.3125 | 2 |
saleor/core/jwt.py | autobotasia/saleor | 1 | 4320 | <filename>saleor/core/jwt.py
from datetime import datetime, timedelta
from typing import Any, Dict, Optional
import graphene
import jwt
from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest
from ..account.models import User
from ..app.models import App
from .permissions import (
get_p... | 1.992188 | 2 |
locust/configuration.py | pancaprima/locust | 1 | 4321 | <filename>locust/configuration.py
import os, json, logging, jsonpath_rw_ext, jsonpath_rw
from jsonpath_rw import jsonpath, parse
from . import events
from ast import literal_eval
from flask import make_response
logger = logging.getLogger(__name__)
CONFIG_PATH = '/tests/settings/config.json'
class ClientConfiguration:... | 2.5625 | 3 |
data/migrations/0023_discardaction_answers.py | SIXMON/peps | 5 | 4322 | <reponame>SIXMON/peps
# Generated by Django 2.2.4 on 2019-11-14 16:48
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('data', '0022_discardaction'),
]
operations = [
migrations.AddField(
mo... | 1.703125 | 2 |
app/models.py | juanitodread/pitaya-falcon | 0 | 4323 | from json import JSONEncoder
from time import time
class Jsonable:
"""Abstract class to standardize the toJson method to be implemented by any class that wants to be
serialized to JSON"""
def toJson(self):
"""Abstract method"""
raise NotImplementedError('You should implement this method in... | 3.546875 | 4 |
compute_pi.py | jakobkogler/pi_memorize | 0 | 4324 | <gh_stars>0
"""Compute pi."""
from decimal import Decimal, getcontext
import argparse
import itertools
class ComputePi:
"""Compute pi to a specific precision using multiple algorithms."""
@staticmethod
def BBP(precision):
"""Compute pi using the Bailey-Borwein-Plouffe formula."""
getconte... | 3.3125 | 3 |
scripts/01_deploy_data_types.py | LaMemeBete/nodys-smart-contract | 0 | 4325 | #!/usr/bin/python3
import time
from brownie import (
DataTypes,
TransparentUpgradeableProxy,
ProxyAdmin,
config,
network,
Contract,
)
from scripts.helpful_scripts import get_account, encode_function_data
def main():
account = get_account()
print(config["networks"][network.show_active()... | 2.21875 | 2 |
modules/BidirectionalLSTM.py | omni-us/pytorch-retinanet | 12 | 4326 | <filename>modules/BidirectionalLSTM.py
import torch.nn as nn
class BidirectionalLSTM(nn.Module):
# Module to extract BLSTM features from convolutional feature map
def __init__(self, nIn, nHidden, nOut):
super(BidirectionalLSTM, self).__init__()
self.rnn = nn.LSTM(nIn, nHidden, bidirectional=T... | 2.875 | 3 |
release/stubs.min/System/Windows/Forms/__init___parts/PaintEventArgs.py | tranconbv/ironpython-stubs | 0 | 4327 | class PaintEventArgs(EventArgs,IDisposable):
"""
Provides data for the System.Windows.Forms.Control.Paint event.
PaintEventArgs(graphics: Graphics,clipRect: Rectangle)
"""
def Instance(self):
""" This function has been arbitrarily put into the stubs"""
return PaintEventArgs()
def Dispose(self):... | 2.109375 | 2 |
main.py | JaekwangCha/my_pytorch_templet | 0 | 4328 | # written by <NAME>
# version 0.1
# ================== IMPORT CUSTOM LEARNING LIBRARIES ===================== #
from customs.train import train, test
from customs.dataset import load_dataset
from customs.model import load_model
# ================== TRAINING SETTINGS ================== #
import argparse
impo... | 2.140625 | 2 |
test/core/024-sc4-gridftp-http/Rosetta.py | ahnitz/pegasus | 127 | 4329 | <reponame>ahnitz/pegasus
#!/usr/bin/env python3
import logging
import sys
import subprocess
from pathlib import Path
from datetime import datetime
from Pegasus.api import *
logging.basicConfig(level=logging.DEBUG)
# --- Work Dir Setup -----------------------------------------------------------
RUN_ID = "024-sc4-gri... | 1.921875 | 2 |
tests/nls_smoother_test.py | sisl/CEEM | 5 | 4330 | <reponame>sisl/CEEM
import torch
from ceem.opt_criteria import *
from ceem.systems import LorenzAttractor
from ceem.dynamics import *
from ceem.smoother import *
from ceem import utils
def test_smoother():
utils.set_rng_seed(1)
torch.set_default_dtype(torch.float64)
sigma = torch.tensor([10.])
rho... | 2.03125 | 2 |
qiskit/visualization/pulse_v2/device_info.py | godspeed5/qiskit-terra | 15 | 4331 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 2.265625 | 2 |
django_gotolong/mfund/views.py | ParikhKadam/gotolong | 15 | 4332 | # Create your views here.
from .models import Mfund
import plotly.graph_objects as go
from plotly.offline import plot
from plotly.tools import make_subplots
from django.db.models import Q
from django.conf import settings
from django.shortcuts import redirect
from django.contrib.auth.decorators import login_require... | 2.21875 | 2 |
m3u8.py | akria00/m3u8-Downloader-master | 2 | 4333 | #coding: utf-8
from gevent import monkey
monkey.patch_all()
from gevent.pool import Pool
import gevent
import requests
import urllib
import os
import time
import re
import ssl
class Downloader:
def __init__(self, pool_size, retry=3):
self.pool = Pool(pool_size)
self.session = self._get_http_sessio... | 2.46875 | 2 |
buzzbox/restaurants/migrations/0002_restaurant_description.py | Danielvalev/kutiika | 0 | 4334 | <filename>buzzbox/restaurants/migrations/0002_restaurant_description.py
# Generated by Django 3.2.9 on 2021-12-06 10:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('restaurants', '0001_initial'),
]
operations = [
migrations.AddField(... | 1.78125 | 2 |
src/dsrlib/ui/utils.py | fraca7/dsremap | 8 | 4335 | <filename>src/dsrlib/ui/utils.py<gh_stars>1-10
#!/usr/bin/env python3
import os
import contextlib
from PyQt5 import QtCore, QtWidgets
from dsrlib.settings import Settings
class LayoutBuilder:
def __init__(self, target):
self.target = target
self._stack = []
@contextlib.contextmanager
d... | 2.15625 | 2 |
src/tiden/tidenrunner.py | mshonichev/example_pkg | 0 | 4336 | <reponame>mshonichev/example_pkg<filename>src/tiden/tidenrunner.py
#!/usr/bin/env python3
#
# Copyright 2017-2020 GridGain Systems.
#
# 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://... | 1.859375 | 2 |
ludwig/data/cache/manager.py | ludwig-ai/ludw | 970 | 4337 | import logging
import os
import re
import uuid
from pathlib import Path
from ludwig.constants import CHECKSUM, META, TEST, TRAINING, VALIDATION
from ludwig.data.cache.util import calculate_checksum
from ludwig.utils import data_utils
from ludwig.utils.fs_utils import delete, path_exists
logger = logging.getLogger(__n... | 2.390625 | 2 |
test_calc_base.py | kshshkim/factorioCalcPy | 1 | 4338 | import pprint
from FactorioCalcBase.data.binary import sorted_recipe_list, production_machine_category_list_dict
from FactorioCalcBase.recipe import Recipe
from FactorioCalcBase.calculator_base import CalculatorBase
from FactorioCalcBase.dependency_dict_common_function import dict_add_number
import time
def test_chan... | 2.328125 | 2 |
lib/py/src/Thrift.py | ahfeel/thrift | 3 | 4339 | # Copyright (c) 2006- Facebook
# Distributed under the Thrift Software License
#
# See accompanying file LICENSE or visit the Thrift site at:
# http://developers.facebook.com/thrift/
class TType:
STOP = 0
VOID = 1
BOOL = 2
BYTE = 3
I08 = 3
DOUBLE = 4
I16 = 6
I32 = 8
I64 = 10
STR... | 1.703125 | 2 |
engine.py | nyumaya/wake-word-benchmark | 0 | 4340 | <gh_stars>0
#
# Copyright 2018 Picovoice Inc.
#
# 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 agree... | 2.140625 | 2 |
objO_and_ctxMgr/harakiri.py | thirschbuechler/didactic-barnacles | 0 | 4341 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 20 22:18:58 2020
@author: https://stackoverflow.com/questions/293431/python-object-deleting-itself
@editor: thirschbuechler
this is probably overkill to alternatively exit a with-context, rather than by exception,
but hey, maybe it will be needed, ... | 2.6875 | 3 |
chapter2/gestures.py | srimani-programmer/Opencv-with-Python-Blueprints-second-Edition | 39 | 4342 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A module containing an algorithm for hand gesture recognition"""
import numpy as np
import cv2
from typing import Tuple
__author__ = "<NAME>"
__license__ = "GNU GPL 3.0 or later"
def recognize(img_gray):
"""Recognizes hand gesture in a single-channel depth image
... | 3.734375 | 4 |
satt/trace/logger/panic.py | jnippula/satt | 54 | 4343 | <filename>satt/trace/logger/panic.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
// Copyright (c) 2015 Intel Corporation
//
// 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
//
// h... | 2.671875 | 3 |
xlab/cli.py | csalcedo001/xlab | 1 | 4344 | import sys
import os
from . import filesys
MAIN_USAGE_MESSAGE = """
usage: xlab command ...
Options:
positional arguments:
command
project
"""
def project(args):
if len(args) != 1:
print("error: Invalid arguments.")
exit()
if args[0] == 'init':
root = os.getcwd()
... | 2.640625 | 3 |
python/paddle/optimizer/adamw.py | jzhang533/Paddle | 0 | 4345 | # Copyright (c) 2021 PaddlePaddle 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 appli... | 2.09375 | 2 |
tests/resources/test_interactions.py | VinLau/BAR_API | 1 | 4346 | <reponame>VinLau/BAR_API<gh_stars>1-10
from api import app
from unittest import TestCase
class TestIntegrations(TestCase):
maxDiff = None
def setUp(self):
self.app_client = app.test_client()
def test_get_itrns(self):
"""
This function test retrieving protein interactions for var... | 2.859375 | 3 |
src/dialogflow-java-client-master/samples/clients/VirtualTradingAssistant/src/main/java/ai/examples/scraper/historicalScrape.py | 16kozlowskim/Group-20-SE | 0 | 4347 | # install BeautifulSoup4 before running
#
# prints out historical data in csv format:
#
# [date, open, high, low, close, volume]
#
import re, csv, sys, urllib2
from bs4 import BeautifulSoup
# If start date and end date is the same only one value will be returned and
# if not the multiple values which can be used to ma... | 3.140625 | 3 |
client/client.py | odontomachus/hotbox | 0 | 4348 | <reponame>odontomachus/hotbox<filename>client/client.py<gh_stars>0
import sys
import io
from collections import defaultdict
import struct
from time import sleep
import queue
import threading
import serial
from serial import SerialException
RUN_LABELS = ('Time left', 'Temp 1', 'Temp 2', 'Off Goal', 'Temp Change', 'Dut... | 2.46875 | 2 |
test/functional/abc-sync-chain.py | ComputerCraftr/devault | 35 | 4349 | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test that a node receiving many (potentially out of order) blocks exits
initial block download (IBD; this occur... | 2.359375 | 2 |
djangostagram/posts/models.py | hongsemy/InstagramWithDjango | 0 | 4350 | <reponame>hongsemy/InstagramWithDjango
from django.db import models
from djangostagram.users import models as user_model
# Create your models here.
# This class is used in other models as an inheritance.
# An often-used pattern
class TimeStamedModel(models.Model):
created_at = models.DateTimeField(auto_now_add=T... | 2.8125 | 3 |
guillotina/contrib/workflows/events.py | rboixaderg/guillotina | 173 | 4351 | from guillotina.contrib.workflows.interfaces import IWorkflowChangedEvent
from guillotina.events import ObjectEvent
from zope.interface import implementer
@implementer(IWorkflowChangedEvent)
class WorkflowChangedEvent(ObjectEvent):
"""An object has been moved"""
def __init__(self, object, workflow, action, c... | 1.921875 | 2 |
data_steward/cdr_cleaner/cleaning_rules/covid_ehr_vaccine_concept_suppression.py | lrwb-aou/curation | 16 | 4352 | """
Suppress COVID EHR vaccine concepts.
Original Issues: DC-1692
"""
# Python imports
import logging
# Project imports
from cdr_cleaner.cleaning_rules.deid.concept_suppression import AbstractBqLookupTableConceptSuppression
from constants.cdr_cleaner import clean_cdr as cdr_consts
from common import JINJA_ENV, CDM_T... | 1.875 | 2 |
pydbhub/httphub.py | sum3105/pydbhub | 18 | 4353 | import pydbhub
from typing import Any, Dict, List, Tuple
from json.decoder import JSONDecodeError
import requests
import io
def send_request_json(query_url: str, data: Dict[str, Any]) -> Tuple[List[Any], str]:
"""
send_request_json sends a request to DBHub.io, formatting the returned result as JSON
Param... | 3.3125 | 3 |
test_calcscore.py | BrandonLeiran/bracket-scoring | 0 | 4354 | <reponame>BrandonLeiran/bracket-scoring
import pytest
from calcscore import round_score
# you'll be picking what teams make it to the next round
# - so picking 32, then 16, then 8, 4, 2, 1...i.e. round 1-6 winners
# teams will have a name & a seed
# seed doesn't change, so maybe make that not passed around w/ result... | 3.03125 | 3 |
tests/test_get.py | bgyori/pyobo | 0 | 4355 | <filename>tests/test_get.py
import unittest
from operator import attrgetter
import obonet
from pyobo import SynonymTypeDef, get
from pyobo.struct import Reference
from pyobo.struct.struct import (
iterate_graph_synonym_typedefs, iterate_graph_typedefs, iterate_node_parents, iterate_node_properties,
iterate_no... | 2.34375 | 2 |
src/commons.py | ymontilla/WebScrapingCatastro | 0 | 4356 | <reponame>ymontilla/WebScrapingCatastro
# -*- coding: utf-8 -*-
# +
## Utilidades comunes entre places y OSM.
# +
import csv
import ast
import codecs
from math import cos, asin, sqrt
# +
def read_csv_with_encoding(filename, delimiter="|", encoding="iso-8859-1"):
with codecs.open(filename, encoding=encoding) as ... | 3.40625 | 3 |
GamesGetter.py | JamescMcE/BasketBet | 0 | 4357 | #This script Imports Game Data from ESPN, and Odds from the ODDS-API, and then imports them into a MySQL table, example in workbench here https://puu.sh/HOKCj/ce199eec8e.png
import mysql.connector
import requests
import json
import datetime
import time
#Connection to the MYSQL Server.
mydb = mysql.connector.... | 3.046875 | 3 |
neurodocker/tests/test_neurodocker.py | effigies/neurodocker | 1 | 4358 | <filename>neurodocker/tests/test_neurodocker.py
"""Tests for neurodocker.main"""
# Author: <NAME> <<EMAIL>>
from __future__ import absolute_import, unicode_literals
import sys
import pytest
from neurodocker.neurodocker import create_parser, parse_args, main
def test_generate():
args = ("generate -b ubuntu:17.... | 2.296875 | 2 |
fuzzers/011-cle-ffconfig/generate.py | tmichalak/prjuray | 39 | 4359 | <filename>fuzzers/011-cle-ffconfig/generate.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The Project U-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier:... | 1.992188 | 2 |
hmc/integrators/states/riemannian_leapfrog_state.py | JamesBrofos/Thresholds-in-Hamiltonian-Monte-Carlo | 1 | 4360 | from typing import Callable
import numpy as np
from hmc.integrators.states.leapfrog_state import LeapfrogState
from hmc.integrators.fields import riemannian
from hmc.linalg import solve_psd
class RiemannianLeapfrogState(LeapfrogState):
"""The Riemannian leapfrog state uses the Fisher information matrix to provi... | 2.578125 | 3 |
MultirangerTest.py | StuartLiam/DroneNavigationOnboard | 0 | 4361 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Cop... | 2.1875 | 2 |
employees/choices.py | sauli6692/barbershop | 0 | 4362 | from django.utils.translation import ugettext_lazy as _
USER_TYPE_STAFF = 'STAFF'
USER_TYPE_ADMIN = 'ADMIN'
USER_TYPE_BARBER = 'BARBER'
USER_TYPE_CHOICES = (
(USER_TYPE_STAFF, _('Dev')),
(USER_TYPE_ADMIN, _('Admin')),
(USER_TYPE_BARBER, _('Barber')),
) | 1.734375 | 2 |
tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/html5test.py | google-ar/chromium | 2,151 | 4363 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from common.chrome_proxy_shared_page_state import ChromeProxySharedPageState
from telemetry.page import page as page_module
from telemetry import story
cla... | 2.53125 | 3 |
lessons/sqlite_example/database.py | eliranM98/python_course | 6 | 4364 | <reponame>eliranM98/python_course
"""
in this example we want to create a user credentials database with:
user_id & password
logger showing connection logs, DB version, errors during fetching & executing
"""
import sqlite3
from lessons.sqlite_example.log import create as create_logger
class Commands:
create_user... | 4.375 | 4 |
backend/app/projectx/routing.py | emmawoollett/projectx | 0 | 4365 | <gh_stars>0
from django.urls import re_path
from projectx.consumers import UserWebSocketConsumer
from .consumers import UserWebSocketConsumer
websocket_urlpatterns = [
re_path(r"^ws/$", UserWebSocketConsumer.as_asgi()),
]
| 1.625 | 2 |
aldryn_search/cms_apps.py | lab360-ch/aldryn-search | 11 | 4366 | <reponame>lab360-ch/aldryn-search<filename>aldryn_search/cms_apps.py<gh_stars>10-100
from django.utils.translation import ugettext_lazy as _
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from .conf import settings
class AldrynSearchApphook(CMSApp):
name = _("aldryn search")
def ... | 1.703125 | 2 |
BizPy/openpyxl/20200513/horizontal_chart.py | t2y/python-study | 18 | 4367 | <filename>BizPy/openpyxl/20200513/horizontal_chart.py
import pandas as pd
from openpyxl import Workbook
from openpyxl.chart import BarChart, Reference
wb = Workbook()
ws = wb.active
df = pd.read_csv('population.csv')
ws.append(df.columns.tolist())
for row in df.values:
ws.append(list(row))
row_length... | 2.953125 | 3 |
changes/api/serializer/models/logsource.py | alex/changes | 1 | 4368 | <filename>changes/api/serializer/models/logsource.py<gh_stars>1-10
from changes.api.serializer import Serializer, register
from changes.models.log import LogSource
@register(LogSource)
class LogSourceSerializer(Serializer):
def serialize(self, instance, attrs):
return {
'id': instance.id.hex,
... | 1.8125 | 2 |
examples/prostate/data_preparation/utils/nrrd_to_nifti.py | IsaacYangSLA/NVFlare | 0 | 4369 | <filename>examples/prostate/data_preparation/utils/nrrd_to_nifti.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. 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
#
# ... | 2.203125 | 2 |
setup.py | jszakmeister/rst2ctags | 23 | 4370 | <reponame>jszakmeister/rst2ctags
from setuptools import setup
import io
import os
import re
version_re = re.compile(r'^__version__ = "([^"]*)"$')
# Find the version number.
with open('rst2ctags.py', 'r') as f:
for line in f:
line = line.rstrip()
m = version_re.match(line)
if m:
... | 2.078125 | 2 |
py-ws/hardshare/cli.py | rerobots/hardshare | 8 | 4371 | #!/usr/bin/env python
# Copyright (C) 2018 rerobots, Inc.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 1.882813 | 2 |
Dataset/Leetcode/train/7/93.py | kkcookies99/UAST | 0 | 4372 | <reponame>kkcookies99/UAST
class Solution:
def XXX(self, x: int) -> int:
def solve(x):
a = list(map(int,str(x)))
p = {}
d=0
for ind, val in enumerate(a):
p[ind] = val
for i, v in p.items():
d += v*(10**i)
... | 2.8125 | 3 |
app/realty.py | JenBanks8585/Labs_CitySpireDS | 0 | 4373 | """Realty Info"""
import os
import requests
from dotenv import load_dotenv
from fastapi import APIRouter, Depends
import sqlalchemy
from pydantic import BaseModel, SecretStr
from app import config
from app.walk_score import *
load_dotenv()
router = APIRouter()
headers = {'x-rapidapi-key': os.getenv('api_key'),
... | 2.53125 | 3 |
dist/weewx-4.0.0b3/bin/weewx/junk2.py | v0rts/docker-weewx | 10 | 4374 | from __future__ import print_function
import time
import weeutil.weeutil
import weewx.manager
import weewx.xtypes
archive_sqlite = {'database_name': '/home/weewx/archive/weepwr.sdb', 'driver': 'weedb.sqlite'}
archive_mysql = {'database_name': 'weewx', 'user': 'weewx', 'password': '<PASSWORD>', 'driver': 'weedb.mysql'... | 2.328125 | 2 |
fast_lemon_api_test.py | a6502/fast_lemon_api | 0 | 4375 | <gh_stars>0
#!/usr/bin/env pytest-3
from fastapi.testclient import TestClient
from fast_lemon_api import app
client = TestClient(app)
def test_get_root():
response = client.get("/")
assert response.status_code == 200
assert response.text == "Welcome to the fast-lemon-api!\n"
neworder = {
"isin": ... | 2.640625 | 3 |
tests/regenerate_credentials.py | andrewkozlik/pam-u2f | 0 | 4376 | #!/bin/python2
import collections
import re
import subprocess
import sys
PUC = "../pamu2fcfg/pamu2fcfg"
resident = ["", "-r"]
presence = ["", "-P"]
pin = ["", "-N"]
verification = ["", "-V"]
Credential = collections.namedtuple("Credential", "keyhandle pubkey attributes oldformat")
sshformat = 0
def print_test_... | 2.21875 | 2 |
tensorflow/contrib/distributions/python/kernel_tests/bijectors/affine_scalar_test.py | zhangyujing/tensorflow | 13 | 4377 | # Copyright 2016 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.140625 | 2 |
mule/util/algorand_util.py | bricerisingalgorand/mule | 0 | 4378 | <reponame>bricerisingalgorand/mule
import os
import subprocess
import json
import urllib.request
from mule.util import os_util
from mule.util import file_util
from mule.util import time_util
from mule.util import s3_util
from mule.util import semver_util
import platform
def build_algo_release_url(package_type, channel... | 2.09375 | 2 |
examples/showcase/src/demos_panels/scrollPanel.py | allbuttonspressed/pyjs | 0 | 4379 | """
The ``ui.ScrollPanel`` class implements a panel that scrolls its contents.
If you want the scroll bars to be always visible, call
``setAlwaysShowScrollBars(True)``. You can also change the current scrolling
position programmatically by calling ``setScrollPosition(vPos)`` and
``setScrollHorizontalPosition(hPos)`` ... | 3.71875 | 4 |
psdn.py | xiongchiamiov/phone-suitable-domain-name | 3 | 4380 | <filename>psdn.py
#!/usr/bin/env python3
# May you recognize your weaknesses and share your strengths.
# May you share freely, never taking more than you give.
# May you find love and love everyone you find.
import re
import time
import whois
phone_spellable = re.compile(r'^[filoqrsuwxy]+$')
candidate_words = []
w... | 2.8125 | 3 |
src/requester/py/ElevatorTestCaseList.py | akzare/Elevator_Sys_Design | 1 | 4381 | '''
* @file ElevatorTestCaseList.py
* @author <NAME>
* @date 30 July 2020
* @version 0.1
* @brief Implements a class to hold all the test cases during the program life cycle.
'''
#!/usr/bin/env python3
import sys
import ctypes
import ElevatorConfig as cfg
import ElevatorMsgProtocol as msgProto
class Elev... | 2.6875 | 3 |
cart/views.py | pmaigutyak/mp-cart | 1 | 4382 | <gh_stars>1-10
from django.utils.translation import ugettext
from django.views.decorators.http import require_POST
from django.http import JsonResponse
from django.shortcuts import render
from django.core.exceptions import ValidationError
from django.views.decorators.csrf import csrf_exempt
from cart.lib import get_c... | 1.96875 | 2 |
ChessAI/src/const.py | darius-luca-tech/AI_Projects | 2 | 4383 |
#------ game constants -----#
#players
WHITE = 0
BLACK = 1
BOTH = 2
#color for onTurnLabel
PLAYER_COLOR = ["white", "black"]
#figures
PAWN = 1
KNIGHT = 2
BISHOP = 3
ROOK = 4
QUEEN = 5
KING = 6
FIGURE_NAME = [ "", "pawn", "knight", "bishop", "rook", "queen", "king" ]
#used in move 32bit for prom... | 2.109375 | 2 |
agent.py | kapzlok2408/Pokemon-Showdown-Node-Bot | 0 | 4384 | <reponame>kapzlok2408/Pokemon-Showdown-Node-Bot<gh_stars>0
import gym
import gym_pokemon
import random
if __name__ == "__main__":
env = gym.make("Pokemon-v0")
total_reward = 0.0
total_steps = 0
obs = env.reset()
while True:
action = random.randint(-1,8)
obs, reward, done, _ = env.step(action)
total_reward ... | 2.546875 | 3 |
Curso-Em-Video-Python/Mundo-2/EXs/EX038.py | victor-da-costa/Aprendendo-Python | 0 | 4385 | <reponame>victor-da-costa/Aprendendo-Python<filename>Curso-Em-Video-Python/Mundo-2/EXs/EX038.py
num1 = int(input('Digite o 1º número: '))
num2 = int(input('Digite o 2º número: '))
if num1 > num2:
print('O {} é maior que {}'.format(num1, num2))
elif num1 < num2:
print('O {} é maior que4 {}'.format(num2, num1))
e... | 4 | 4 |
setup.py | danjjl/ipyfilechooser | 0 | 4386 | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
def read(fname):
"""Open files relative to package."""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='ipyfilechooser',
version='0.3.1',
author='<NAME> (@crahan)',
author_email='<EMAIL... | 1.6875 | 2 |
appengine/chromium_build_logs/handler.py | mithro/chromium-infra | 1 | 4387 | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import appengine_config
import datetime
import json
import logging
import os.path
import pickle
import sys
import urllib
sys.path.append(
os.path.j... | 2.015625 | 2 |
aws_lambda/pytorch/source/caffe2/python/operator_test/elementwise_op_broadcast_test.py | YevhenVieskov/ML-DL-in-production | 4 | 4388 | <reponame>YevhenVieskov/ML-DL-in-production
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from hypothesis import given
import numpy as np
from caffe2.proto import caffe2_pb2
from caffe2.python impor... | 2.234375 | 2 |
kayobe/tests/unit/cli/test_commands.py | jovial/kayobe | 0 | 4389 | <filename>kayobe/tests/unit/cli/test_commands.py
# Copyright (c) 2017 StackHPC Ltd.
#
# 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
#
# Unl... | 2.125 | 2 |
keras2onnx/proto/tfcompat.py | CNugteren/keras-onnx | 1 | 4390 | ###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | 2.203125 | 2 |
back2back/httpmulticlient.py | excentis/ByteBlower_python_examples | 2 | 4391 | <gh_stars>1-10
"""
HTTP MultiServer/MultiClient for the ByteBlower Python API.
All examples are guaranteed to work with Python 2.7 and above
Copyright 2018, Ex<NAME>.
"""
# Needed for python2 / python3 print function compatibility
from __future__ import print_function
# import the ByteBlower module
import byteblowerl... | 2.6875 | 3 |
tools/pod-xml-to-geojson.py | 24-timmarsseglingarna/app | 0 | 4392 | #!/usr/bin/env python
# Converts a PoD XML file to a GeoJSON file.
#
# With the --javascript parameter, the generated file is a javascript
# file defining a variable 'basePodSpec'.
#
# Get the PoD XML file from http://dev.24-timmars.nu/PoD/xmlapi_app.php.
import xml.etree.ElementTree as etree
import argparse
import r... | 2.5625 | 3 |
rastervision/plugin.py | carderne/raster-vision | 3 | 4393 | import os
import json
import importlib
from pluginbase import PluginBase
import rastervision as rv
from rastervision.protos.plugin_pb2 import PluginConfig as PluginConfigMsg
from rastervision.utils.files import download_if_needed
class PluginError(Exception):
pass
def load_conf_list(s):
"""Loads a list of... | 2.234375 | 2 |
acsm/nnutils/resunet.py | eldar/acsm | 52 | 4394 | <filename>acsm/nnutils/resunet.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
from absl import flags
import os
import os.path as osp
import numpy as np
import torch
import torchvision
import torch.nn as nn
from torch.autograd import ... | 1.96875 | 2 |
uproot_methods/common/TVector.py | marinang/uproot-methods | 0 | 4395 | <gh_stars>0
#!/usr/bin/env python
# Copyright (c) 2018, DIANA-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, th... | 1.515625 | 2 |
tpp/controller/ConversionController.py | pennyarcade/TPPP | 0 | 4396 | """
Implements a non interactive controller to controt non-interactive visualizers.
(i.e. those that are used for converting TPP souce code into another format)
"""
from tpp.FileParser import FileParser
from tpp.controller.TPPController import TPPController
class ConversionController(TPPController):
"""
Impl... | 3.25 | 3 |
scrapers/covid_scraper.py | ZachGeo/covidGR_API | 0 | 4397 | from bs4 import BeautifulSoup
from datetime import date
from lxml import html
import requests
import re
import json
class CovidScraper:
def __init__(self):
self.api_url = 'http://127.0.0.1:5000/covidgr'
self.api_sum_url = 'http://127.0.0.1:5000/summary/covidgr'
self.api_test_url = 'http://... | 3.078125 | 3 |
img/autoeditimg.py | schorsche/css3-imageslider | 0 | 4398 | #!/usr/bin/python2.7
import os
from PIL import Image
DATEI_WEB_GROSSE = 700
def isimg(isitimg):
ext = os.path.splitext(isitimg)[1].lower()
if ext == ".jpg" or ext == ".png" or ext == ".gif":
return True
return False
def bearbeiten(datei):
img = Image.open(datei)
wrel = DATEI_WEB_GROSSE / float(img.size[0])
h... | 2.78125 | 3 |
wow/wow.py | brisberg/Kiri-Cogs | 0 | 4399 | import discord
from discord.ext import commands
class WowCog:
"""Custom Cog that had commands for WoW Memes"""
def __init__(self, bot):
self.bot = bot
async def _play(self, url, ctx):
"""Helper for aliasing Play in the Audio module"""
audio = self.bot.get_cog('Audio')
if ... | 2.8125 | 3 |