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 |
|---|---|---|---|---|---|---|
procuret/http/query_parameter.py | Procuret/procuret-python | 0 | 12772451 | <reponame>Procuret/procuret-python<gh_stars>0
"""
Procuret Python
QueryParameter Module
author: <EMAIL>
"""
from typing import Any, TypeVar, Type, List
T = TypeVar('T', bound='QueryParameter')
class QueryParameter:
"""A single URL parameter, e.g. beep=boop"""
def __init__(
self,
key: str,
... | 2.9375 | 3 |
tests/http_tests/test_courtesy_sleep.py | jayvdb/alcazar | 0 | 12772452 | <reponame>jayvdb/alcazar
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------------------------------------------------------------
# includes
# 2+3 compat
from __future__ import absolute_import, division, print_function, unicode_literals
# 3rd p... | 2.234375 | 2 |
airflow/bin/create_user.py | Ahrli/fast_tools | 1 | 12772453 | import airflow
from airflow import models,settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
user.username = 'admin'
user.email = '<EMAIL>'
user.password = '<PASSWORD>'
#user.superuser = '1'
session = settings.Session()
session.add(user)
session.commit()
ses... | 1.953125 | 2 |
cgvt_site/cgvt_site/auth_pipeline.py | ConsultingAtVT/CGVTWebsite | 0 | 12772454 | import requests
from apps.core.models import UserProfile
from django.conf import settings
from social.exceptions import AuthFailed
USER_INFO_LI_REQUEST_URL = ('https://api.linkedin.com/v1/people/~:('
'id,'
'firstName,'
'lastName,'
... | 2.25 | 2 |
caracara/common/module.py | CrowdStrike/falconpy-tools | 2 | 12772455 | """
Generic Caracara API module.
This module contains the the FalconApiModule class, which represents a generic
Caracara API module. All modules, including Hosts, Prevention Policies, etc.
derive from this abstract base class.
"""
import logging
from abc import ABC, abstractmethod
from falconpy import OAuth2
class... | 2.734375 | 3 |
src/app/lib/ssl.py | t4skforce/PenTestingUnit | 0 | 12772456 | import os
import socket
import ssl
from OpenSSL import crypto, SSL
import random
def getSSLContext(app=None,config_folder="/tmp/config", cert_file="app.crt", key_file="app.key"):
""" Create SSL Cert in config folder if it does not exists """
if not os.path.exists(config_folder):
os.makedirs(config_fold... | 2.6875 | 3 |
arvestust/models/image.py | lehvitus/arvestust | 1 | 12772457 | import os
import uuid
import inflection
from django.db import models
from django.urls import reverse
from django.template.defaultfilters import slugify
from django.utils.translation import gettext_lazy as _
from django.conf import settings
from .abstracts import ArvestustRecord, ArvestustFile
from .validators.file impo... | 2.03125 | 2 |
UServer/test/jwt_test.py | soybean217/lora-python | 0 | 12772458 | from flask import Flask
from flask_jwt import JWT, jwt_required, current_identity
from werkzeug.security import safe_str_cmp
class User(object):
def __init__(self, id, username, password):
self.id = id
self.username = username
self.password = password
def __str__(self):
return... | 2.796875 | 3 |
mass_flask_core/signals/__init__.py | mass-project/mass_server | 8 | 12772459 | from mongoengine import signals
from mass_flask_core.models import AnalysisSystem, Report
from .dispatch_request import update_dispatch_request_for_new_sample, create_requests_for_new_analysis_system
from .copy_report_tags import copy_tags_from_report_to_sample
def connect_signals():
signals.post_save.connect(upd... | 1.945313 | 2 |
bit_manipulation/bit/bit_challenge.py | stephank007/python_challenges | 0 | 12772460 | <reponame>stephank007/python_challenges<filename>bit_manipulation/bit/bit_challenge.py
#!/usr/bin/env python
# coding: utf-8
# This notebook was prepared by [<NAME>](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# # Challenge Not... | 3.671875 | 4 |
kitsune/wiki/tests/test_es.py | navgurukul-shivani18/kitsune | 4 | 12772461 | from datetime import datetime, timedelta
from nose.tools import eq_
from kitsune.products.tests import ProductFactory, TopicFactory
from kitsune.search.tests.test_es import ElasticTestCase
from kitsune.wiki.tests import (
DocumentFactory, RevisionFactory, HelpfulVoteFactory, RedirectRevisionFactory)
from kitsune.... | 2.171875 | 2 |
examples/ex06_benchmark.py | alchem0x2A/vasp-interactive-test | 11 | 12772462 | <gh_stars>10-100
"""Run benchmark for VaspInteractive on different molecule systems
Benchmark molecules taken from https://wiki.fysik.dtu.dk/gpaw/devel/ase_optimize/ase_optimize.html
"""
import numpy as np
import os
import tempfile
import random
from time import time
from pathlib import Path
import tempfile
from ase.d... | 2.125 | 2 |
src/edgeorder/azext_edgeorder/generated/custom.py | haroonf/azure-cli-extensions | 1 | 12772463 | <filename>src/edgeorder/azext_edgeorder/generated/custom.py
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Micr... | 1.703125 | 2 |
utils/matlab_call_hevc_tools/saveFileYuv.py | roman-vygon/pyFAST | 0 | 12772464 | # Generated with SMOP 0.41
from libsmop import *
# saveFileYuv.m
def saveFileYuv(mov=None, fileName=None, mode=None):
# save RGB movie [0, 255] to YUV 4:2:0 file
if 1 == mode:
fileId = fopen(fileName, 'w')
# saveFileYuv.m:11
else:
if 2 == mode:
fileId = fopen(fileName, ... | 2.1875 | 2 |
hello.py | iFenr1r/d2bot | 0 | 12772465 | #!/usr/bin/env python
# -*- coding: utf-8 -*
from __future__ import print_function
from cloudant import Cloudant
import atexit
import cf_deployment_tracker
import os
import od_python
import time
import json
from flask import jsonify, Flask, current_app, render_template, request, json
import csv
import sys
... | 2.078125 | 2 |
xl_tensorflow/models/vision/classification/__init__.py | Lannister-Xiaolin/xl_tensorflow | 0 | 12772466 | <filename>xl_tensorflow/models/vision/classification/__init__.py
#!usr/bin/env python3
# -*- coding: UTF-8 -*-
from .utils import AutoAugment, RandAugment, image_from_tfrecord, images2tfrecord
from .efficientnet import EfficientNetB0, EfficientNetB1, EfficientNetB2, EfficientNetB3, EfficientNetB4, \
EfficientNetB5,... | 1.304688 | 1 |
setup.py | luigibonati/md-stateinterpreter | 1 | 12772467 |
"""
stateinterpreter
Interpretation of metastable states from MD simulations
"""
import sys
from setuptools import setup, find_packages, Extension
import versioneer
import numpy
os_name = sys.platform
compile_args = ["-O3", "-ffast-math", "-march=native", "-fopenmp" ]
libraries = ["m"]
link_args = ['-fopenmp']
if os_... | 1.882813 | 2 |
cogs/count.py | OrangutanGaming/OG_SelfBot | 0 | 12772468 | <gh_stars>0
from discord.ext import commands
import discord
class Count():
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=["mcount"])
async def msgcount(self, ctx, user: discord.Member = None, channel: discord.TextChannel = None):
counter = 0
tmp = await ctx.send... | 2.765625 | 3 |
testasm/serve.py | leetim/leetim.github.io | 0 | 12772469 | <reponame>leetim/leetim.github.io<filename>testasm/serve.py
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
httpd.serve_forever()
| 2.109375 | 2 |
sharper.py | TomasRoj/PythonCLI | 0 | 12772470 | <filename>sharper.py
import click
from pyfiglet import Figlet
from PIL import Image, ImageFilter, ImageFont, ImageDraw, ImageEnhance
def sharpen(path):
try:
img = Image.open(path)
img.filter(ImageFilter.SHARPEN()).show()
click.secho("Image processed sucesfully!", fg="green", bold=True)... | 3.015625 | 3 |
api/serializers.py | SchoolOrchestration/ProcessEngineV2 | 0 | 12772471 | <filename>api/serializers.py
'''
Serializers for all the things
'''
from rest_framework import serializers
from .models import (
Process,
ProcessDefinition,
ProcessTask,
RegisteredService,
RegisteredTask,
Task,
Result
)
from django.contrib.auth import get_user_model
class UserSerializer(se... | 2.375 | 2 |
src/data/initial_investigation.py | CarolineFuglsang/san_fransico_crime_data | 0 | 12772472 | <filename>src/data/initial_investigation.py<gh_stars>0
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# loading raw data
raw = pd.read_csv("./data/raw/sf_data.csv", sep=';')
raw_districts = pd.read_csv("./data/raw/sf_districts.csv", sep=';')
raw.head(10)
# -----------... | 2.859375 | 3 |
zentral/contrib/munki/osx_package/builder.py | VegarM/zentral | 1 | 12772473 | import os
from django.urls import reverse
from zentral.contrib.munki.forms import EnrollmentForm
from zentral.utils.osx_package import EnrollmentPackageBuilder
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class MunkiZentralEnrollPkgBuilder(EnrollmentPackageBuilder):
name = "Zentral Munki Enrollment"
... | 2.171875 | 2 |
tf_tile/tilings.py | ccrndn/tf-tile | 9 | 12772474 | # Here we provide the key functions for tile-coding. To avoid huge dimensionality expansion, we have tiled
# per feature variable, but using feature-column cross functionality a pair of feature-variables
# also can be tiled, and also higher orders.
from typing import List
import numpy as np
import tensorflow as tf
fr... | 2.53125 | 3 |
setup.py | EarthObservationSimulator/eosim-gui | 0 | 12772475 | from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='EOSim',
version='0.1',
description='Earth Observation Simulation',
author='BAERI',
author_email='<EMAIL>',
packages=['eosim'],
scripts=[
],
# Cartopy installation may n... | 1.695313 | 2 |
tripleo_common/utils/process.py | openstack/tripleo-common | 52 | 12772476 | # Copyright (c) 2019 Red Hat, 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 agreed to in writ... | 2.1875 | 2 |
setup.py | natfoster82/ocean-commander | 0 | 12772477 | <filename>setup.py<gh_stars>0
from setuptools import setup, find_packages
setup(
name='ocean',
version='0.1',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
example=ocean.scripts.example:cli
... | 1.382813 | 1 |
Maze.py | arduman4/Simple-maze-game | 0 | 12772478 | from collections import deque
from random import *
class Maze():
def __init__(self, player, canvas, y, x):
self.player = player
self.canvas = canvas
self.size = {"x": 2 * x - 1,
"y": 2 * y - 1}
# 0 = air, 1 = wall, 2 = player. 3 = target
def generate(self):
... | 3.890625 | 4 |
pytest_azurepipelines.py | Anthchirp/pytest-azurepipelines | 0 | 12772479 | <reponame>Anthchirp/pytest-azurepipelines
# -*- coding: utf-8 -*-
import os.path
import io
import pkg_resources
import sys
import pytest
__version__ = "1.0.0rc5"
DEFAULT_PATH = "test-output.xml"
DEFAULT_COVERAGE_PATH = "coverage.xml"
def pytest_addoption(parser):
group = parser.getgroup("pytest_azurepipelines... | 2.046875 | 2 |
news/migrations/0001_initial.py | niuwenju/minicms | 83 | 12772480 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | 1.789063 | 2 |
setup.py | emsellem/pymusepipe | 5 | 12772481 | # -*- coding: utf-8 -*-"""
"""
Setup file for pymusepipe.
Use setup.cfg to configure your project.
"""
# Licensed under a MIT style license - see LICENSE.txt
from __future__ import absolute_import, division, print_function
from setuptools import setup, find_packages
version = {}
with open("src/pymusepipe/vers... | 1.476563 | 1 |
src/coronabot.py | ryyaan2004/coronabot | 0 | 12772482 | <filename>src/coronabot.py<gh_stars>0
import collections
import requests
import string
import slack
import os
import copy
from flask import Flask
class PartialFormatter(string.Formatter):
def __init__(self, missing=' 0', bad_fmt='0'):
self.missing, self.bad_fmt = missing, bad_fmt
def get_fie... | 2.640625 | 3 |
app.py | oeg-upm/SOMEF-server | 0 | 12772483 | <reponame>oeg-upm/SOMEF-server<gh_stars>0
import os
import json
from flask import Flask, render_template, jsonify, request, send_from_directory
from werkzeug.utils import secure_filename
#import requests
import sys
app = Flask(__name__)
@app.route("/")
def home():
return render_template('home.html')
if __name_... | 2.21875 | 2 |
src/infovae.py | act65/mri-reconstruction | 8 | 12772484 | import tensorflow as tf
import numpy as np
import src.utils as utils
"""
Implementation of InfoVAE
https://arxiv.org/abs/1706.02262
"""
def reparameterise(x, n, stddev):
"""
Model each output as bing guassian distributed.
Use the reparameterisation trick so we can sample while remaining
differentiable... | 2.75 | 3 |
telepot/test/test35a_admin.py | mpunkenhofer/bs-irc-telegram-bot | 0 | 12772485 | <filename>telepot/test/test35a_admin.py
import sys
import asyncio
import telepot
import telepot.namedtuple
import telepot.aio
from telepot.aio.routing import by_content_type, make_content_type_routing_table
class AdminBot(telepot.aio.Bot):
async def on_chat_message(self, msg):
content_type, chat_type, chat... | 2.203125 | 2 |
skbandit/bandits/base.py | dourouc05/scikit-bandit | 0 | 12772486 | <reponame>dourouc05/scikit-bandit
from abc import ABC, abstractmethod
from typing import Union, List, Dict
import numpy as np
class Bandit(ABC):
"""A stochastic, multi-armed bandit player.
A bandit player can be implemented using three methods:
* a constructor: to create the player (required parameters,... | 3.75 | 4 |
tastyworks/__init__.py | olyoberdorf/tastyworks_api | 198 | 12772487 | <gh_stars>100-1000
import logging
import sys
log = logging.getLogger(__name__)
log.propagate = False
out_hdlr = logging.StreamHandler(sys.stdout)
out_hdlr.setFormatter(logging.Formatter('%(asctime)s %(message)s'))
out_hdlr.setLevel(logging.INFO)
log.addHandler(out_hdlr)
log.setLevel(logging.INFO)
root = logging.getLo... | 2.03125 | 2 |
Multi Processing.py | christianandrew/Tugas_Akhir | 0 | 12772488 | import time
import multiprocessing
import TFLite_detection_webcam
import X
def machinelearning():
exec(TFLite_detection_webcam)
def sensors():
exec(
p1 = multiprocessing.Process(target=machinelearning(),args=[])
p2 = multiprocessing.Process(target=,args=[])
p3 = multiprocessing.Process(target=,arg... | 2.796875 | 3 |
crash_course/ch13/exec/stars.py | dantin/python-by-example | 0 | 12772489 | <reponame>dantin/python-by-example
import pygame
import sys
from pygame.sprite import Group
from pygame.sprite import Sprite
class Settings():
"""A class that stores all settings."""
def __init__(self):
"""Initialize the game's settings."""
# Screen settings
self.screen_width = 1200... | 3.578125 | 4 |
leetcode/python/93.restore-ip-addresses.py | phiysng/leetcode | 3 | 12772490 | <filename>leetcode/python/93.restore-ip-addresses.py<gh_stars>1-10
from typing import List
# valid ip address has 4 number, each of them is [0,255] and is valid decimal number
# which indicates we need to rule out number like this : [01,00]
class Solution:
def __init__(self):
self.validIp = []
def r... | 3.46875 | 3 |
projects/blueprints/data_visualisation/world_gdp.py | only-romano/junkyard | 0 | 12772491 | <filename>projects/blueprints/data_visualisation/world_gdp.py
#! Json practice
import json
import pygal_maps_world.maps as pm
from countries import get_country_code
from pygal.style import RotateStyle as RS, LightColorizedStyle as LCS
# Load the data into a list.
filename = 'gdp2.json'
with open(filename) as f... | 3.15625 | 3 |
01Firmware/PDM_USB/PDM_USB/src/endpoint0/chanstringgen.py | simongapp/xmos_usb_mems_interface | 9 | 12772492 |
def genstrings(outputChanCount, chanString, portString, structureString, adc_dac):
for i in range(1,outputChanCount):
print "#if (NUM_USB_CHAN_{c} > {i}-1)\n\
.{s}ChanStr_{i} = \"\"\n\
#if ({i} < I2S_CHANS_{adcdac}+1)\n\
\"Analogue {i}\"\n\
#endif\n\
#if (({i} < SPDI... | 2.71875 | 3 |
cracking-code-interview/chapter_03/3-5_sort_stack.py | italo-batista/problems-solving | 0 | 12772493 | <reponame>italo-batista/problems-solving<gh_stars>0
import sys
sys.path.append('./datastructures')
from datastructures import Stack
def sort_stack(stack):
temp_stack = Stack()
threshold = stack.pop()
while not stack.is_empty():
if stack.peek() >= threshold:
stack_node = stack.pop()
... | 3.703125 | 4 |
exonum-java-binding/exonum_launcher_java_plugins/exonum_java_runtime_plugin/plugin.py | skletsun/exonum-java-binding | 0 | 12772494 | # Copyright 2019 The Exonum Team
#
# 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 writi... | 2.0625 | 2 |
src/jNlp/eProcessing.py | Reynolddoss/jProcessing | 133 | 12772495 | <filename>src/jNlp/eProcessing.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pkg_resources import resource_stream
import sys, os, subprocess
from subprocess import call
import xml.etree.cElementTree as etree
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
if __name__ == '__main__':
pass
| 1.75 | 2 |
pretrain_model.py | MatheusNtg/character-bert-pretraining | 27 | 12772496 | <filename>pretrain_model.py
# coding=utf-8
# Copyright (c) 2020, <NAME>. 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... | 1.71875 | 2 |
config.py | enwawerueli/footprints | 1 | 12772497 | <gh_stars>1-10
class Config(object):
ORG_NAME = 'footprints'
ORG_DOMAIN = 'footprints.devel'
APP_NAME = 'Footprints'
APP_VERSION = '0.4.0'
| 1.257813 | 1 |
minimumSizeSubarraySum.py | anishmo99/DailyInterviewPro | 1 | 12772498 | <reponame>anishmo99/DailyInterviewPro
class Solution:
def minSubArrayLen(self, s: int, nums: List[int]) -> int:
left, sum, count = 0, 0, float('inf')
for right in range(len(nums)):
sum += nums[right]
while sum >= s:
count = min(count, rig... | 3.171875 | 3 |
functionaltests/api/camp/test_platform_endpoints.py | ed-/solum | 0 | 12772499 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# 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 w... | 2.0625 | 2 |
random_exercises/ex1.py | ClaudiuCreanga/kaggle | 5 | 12772500 | <reponame>ClaudiuCreanga/kaggle<gh_stars>1-10
from typing import List
def rotLeft(a, d):
for _ in range(d):
a.append(a[0])
del a[0]
return a
#print(rotLeft([1, 2, 3, 4, 5], 3))
def minimumBribes(q):
result = 0
flag = False
for passing in range(len(q)-1, 0, -1):
if flag:
... | 3.703125 | 4 |
library/tetration_application.py | chrivand/ansible-module | 6 | 12772501 | ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: tetration_application
short description: Enables creation, modification, deletion and query of an application
version_added: '2.9'
description:
-... | 1.804688 | 2 |
liberapay/testing/elsewhere.py | virtuchain/liberapay.com | 0 | 12772502 | <gh_stars>0
# flake8: noqa
"""
Examples of data returned by the APIs of the elsewhere platforms.
They are wrapped in lambdas to prevent tests from persistently modifying the
data.
"""
import xml.etree.ElementTree as ET
bitbucket = lambda: {
"username": "whit537",
"website": "https://www.gittip.com/whit537/... | 2.171875 | 2 |
tests/test_server.py | ZhukovAlexander/rafter | 9 | 12772503 | import unittest
from unittest import mock
import uuid
import asyncio
from rafter.server import RaftServer
from rafter.models import LogEntry
from rafter.exceptions import NotLeaderException
from .mocks import Log, Storage, Service
class RaftServerTest(unittest.TestCase):
def setUp(self):
self.loop = asy... | 2.421875 | 2 |
pong/paddle.py | Arihant25/beginner-python-projects | 1 | 12772504 | from turtle import Turtle
class Paddle(Turtle):
def __init__(self, coordinates):
super().__init__()
self.penup()
self.shape('square')
self.shapesize(stretch_wid=5, stretch_len=1)
self.goto(coordinates)
self.color('white')
def move_up(self):
self.sety(se... | 3.71875 | 4 |
bluegraph/backends/utils.py | BlueBrain/BlueGraph | 25 | 12772505 | <reponame>BlueBrain/BlueGraph
"""A set of factory utils for different processing backends."""
from bluegraph.exceptions import BlueGraphException
from .configs import (ANALYZER_CLS, EMBEDDER_CLS)
def create_analyzer(analyzer_type, backend,
pgframe=None, directed=True,
uri=None... | 2.21875 | 2 |
project_euler/solutions/problem_96.py | cryvate/project-euler | 0 | 12772506 | from collections import Counter
from time import time
from typing import List, Optional, Tuple
from ..framework.load_file import load_file
from ..library.base import list_to_number
Sudoku = List[List[int]]
spec = '{:6.6f}'
class SetNoZero(set):
def add(self, x) -> None:
if x != 0:
super().ad... | 3.359375 | 3 |
articles/migrations/0002_auto_20201224_1436.py | dmahon10/django-tiered-membership-web-app | 0 | 12772507 | <filename>articles/migrations/0002_auto_20201224_1436.py
# Generated by Django 3.1.4 on 2020-12-24 14:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0001_initial'),
]
operations = [
migrations.AddField(
model... | 1.484375 | 1 |
karp5/tests/unit_tests/server/test_searching.py | spraakbanken/karp-backend-v5 | 4 | 12772508 | from unittest import mock
import pytest
from karp5.server import searching
def test_autocompletequery(app):
mode = "foo"
q = "any"
boost = {"term": {"field": {"boost": "500", "value": q}}}
result = searching.autocompletequery(mode, boost, q)
expected = {"bool": {"should": [boost, {"match_phras... | 2.296875 | 2 |
misc/py/create_time_vs_error_plot_data_3d.py | sampotter/eikonal | 1 | 12772509 | #!/usr/bin/env python3
import argparse
def parse_args():
p = argparse.ArgumentParser()
p.add_argument('path', type=str)
p.add_argument('-m', '--minpow', type=int, default=3)
p.add_argument('-M', '--maxpow', type=int, default=7)
p.add_argument('-s', '--step', type=int, default=2)
p.add_argument... | 2.15625 | 2 |
imcsdk/mometa/bios/BiosProfileToken.py | ragupta-git/ImcSdk | 0 | 12772510 | <reponame>ragupta-git/ImcSdk<filename>imcsdk/mometa/bios/BiosProfileToken.py
"""This module contains the general information for BiosProfileToken ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosProfileTokenConsts:
... | 1.796875 | 2 |
data_processing.py | yuddim/DefectSoft | 2 | 12772511 | <reponame>yuddim/DefectSoft
from __future__ import print_function
from tensorflow.keras.preprocessing.image import ImageDataGenerator
import numpy as np
import os
import glob
import skimage.io as io
import cv2
import time
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from sh... | 2.453125 | 2 |
pyclassyfire/dev_multipage.py | oolonek/pyclassyfire | 0 | 12772512 | <gh_stars>0
from pyclassyfire import client
url = "http://classyfire.wishartlab.com"
chunk_size = 50
sleep_interval = 100
tabular_query_multipage('./test_data/sample_table.tsv', 'sanitized_smiles', 'excel-tab')
| 1.695313 | 2 |
pgcontents/checkpoints.py | freedom079215/pgcontents | 138 | 12772513 | <reponame>freedom079215/pgcontents
"""
An IPython FileContentsManager that uses Postgres for checkpoints.
"""
from __future__ import unicode_literals
from .api_utils import (
_decode_unknown_from_base64,
outside_root_to_404,
reads_base64,
to_b64,
writes_base64,
)
from .managerbase import PostgresMa... | 2.046875 | 2 |
utils/stats_file_handeling.py | HereIsANiceNickname/CAS19 | 0 | 12772514 | import threading as th
import queue as q
import yaml
STOP_STAT = "STOP"
class StatsFileHandler:
class StatsWriter(th.Thread):
def __init__(self, queue, file_path):
self.running = True
self.queue = queue
self.file_path = file_path
self.f_pointer_map = {}
... | 2.859375 | 3 |
keyoscacquire/scripts/example.py | asvela/keyoscacquire | 10 | 12772515 | <reponame>asvela/keyoscacquire
import keyoscacquire as koa
import matplotlib.pyplot as plt
def averaged_trace(scope, measurement_number, averages=8):
# Set the number of averages and get a trace
time, voltages, _ = scope.set_options_get_trace(acq_type=f"AVER{averages}")
# Save the trace data as a csv and a... | 2.765625 | 3 |
riptable/rt_meta.py | 972d5defe3218bd62b741e6a2f11f5b3/riptable | 307 | 12772516 | __all__ = ['Item', 'Info', 'Doc', 'apply_schema', 'info', 'doc']
from typing import Optional, List
from .rt_struct import Struct
from .rt_fastarray import FastArray
from .rt_display import DisplayText
META_DICT = '_meta'
DOC_KEY = 'Doc'
DESCRIPTION_KEY = 'Description'
STEWARD_KEY = 'Steward'
TYPE_KEY = '... | 2.375 | 2 |
line.py | salt-die/Snippets | 3 | 12772517 | def line(y1, x1, y2, x2):
"""
Yield integer coordinates for a line from (y1, x1) to (y2, x2).
"""
dy = abs(y2 - y1)
dx = abs(x2 - x1)
if dy == 0: # Horizontal
for x in range(x1, x2 + 1):
yield y1, x
elif dx == 0: # Vertical
for y in range(y1, y2 + 1):
... | 4.03125 | 4 |
en_transformer/utils.py | dumpmemory/En-transformer | 108 | 12772518 | <filename>en_transformer/utils.py
import torch
from torch import sin, cos, atan2, acos
def rot_z(gamma):
return torch.tensor([
[cos(gamma), -sin(gamma), 0],
[sin(gamma), cos(gamma), 0],
[0, 0, 1]
], dtype = gamma.dtype)
def rot_y(beta):
return torch.tensor([
[cos(beta), 0, ... | 2.625 | 3 |
api/migrate/specs.py | michaelkerrytf/finalproject | 0 | 12772519 | <gh_stars>0
from ..env import Env
def migrate_specs(spec_list: list, target_env:Env):
"""
migrate from source organization to target
construct response dict
:param target_env:
:param spec_list:
:return:
"""
response_log = []
for spec in spec_list: # spec is a str: 'adex-spec-name'... | 2.015625 | 2 |
Test/untitled0.py | mahdijo6731/SugarScape | 6 | 12772520 | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 06:17:11 2018
@author: ymamo
"""
test =
if test == set():
print (test)
else:
print ("False") | 2.96875 | 3 |
ucsmsdk/mometa/equipment/EquipmentComputeConn.py | Kego/ucsmsdk | 78 | 12772521 | """This module contains the general information for EquipmentComputeConn ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class EquipmentComputeConnConsts:
SERVER_SIOC_CONNECTIVITY_SINGLE_SERVER_DUAL_SIOC = "single-server-du... | 2.015625 | 2 |
ML/NaiveBayes/app.py | JadeMaveric/GEC | 1 | 12772522 | <reponame>JadeMaveric/GEC
import streamlit as st
import pandas as pd
from NaiveBayes import NaiveBayes
st.set_page_config(layout='centered')
st.title("Naive Bayes Classifier")
st.markdown("By [@JuliusAlphonso](https://twitter.com/JuliusAlphonso)")
dataset = st.sidebar.file_uploader("Choose a file")
probability_selec... | 3.515625 | 4 |
pyicic/IC_Structures.py | zivlab/py-ic-imaging-control | 28 | 12772523 | <filename>pyicic/IC_Structures.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ctypes import *
class GrabberHandle(Structure):
pass
GrabberHandle._fields_ = [('unused', c_int)]
class FilterParameter(Structure):
pass
FilterParameter._fields_ = [('Name', c_char * 30),
('Type... | 1.984375 | 2 |
tests/functional-tests/utils/scale_operator_function.py | Bhaskers-Blu-Org1/ibm-spectrum-scale-csi | 0 | 12772524 | import time
import logging
import yaml
from kubernetes import client
from kubernetes.client.rest import ApiException
LOGGER = logging.getLogger()
def set_global_namespace_value(namespace_name):
"""
Make namespace as global to be used in later functions
Args:
param1: namespace_name - ... | 2.25 | 2 |
openapi_server/models/block.py | havardhuns/graphsense-REST | 0 | 12772525 | # coding: utf-8
from datetime import date, datetime
from typing import List, Dict, Type
from openapi_server.models.base_model_ import Model
from openapi_server import util
class Block(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class... | 2.671875 | 3 |
functionality/yolo_detect.py | shrwh/QtMultiUAVGui | 0 | 12772526 | import torch
from models.experimental import attempt_load
from utils.datasets import LoadImages
from utils.general import check_img_size, non_max_suppression, scale_coords, set_logging
from utils.torch_utils import select_device, time_synchronized
import multiprocessing as mp
# 目标检测
def detect_center(frame_cap,conditi... | 2.1875 | 2 |
webdriver_setup/windows.py | xloem/webdriver-setup | 1 | 12772527 | <reponame>xloem/webdriver-setup
from selenium import webdriver
from webdriver_manager.microsoft import EdgeChromiumDriverManager, IEDriverManager
from webdriver_setup.driver import DriverBase
class EdgeDriver(DriverBase):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def create_driver(s... | 2.765625 | 3 |
data_retrivers/yarn_log_parser.py | IncioMan/ci_data_issue_prediction | 1 | 12772528 | """Test Suites: 370 passed, 370 total
Tests: 4 skipped, 1050 passed, 1054 total
Tests: 28 passed, 28 total
Snapshots: 830 passed, 830 total
Time: 67.988s
Ran all test suites.
Done in 99.84s."""
"""Test Suites: 187 passed, 187 total
Tests: 1 skipped, 579 passed, 580 total
Snapshots: 429 pas... | 2.953125 | 3 |
LaundrIT-Project/Pedido/migrations/0040_auto_20191117_1418.py | linikerunk/laundr-it | 1 | 12772529 | # Generated by Django 2.2.7 on 2019-11-17 17:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Pedido', '0039_auto_20191117_1417'),
]
operations = [
migrations.AlterField(
model_name='pedido',
name='valor_total'... | 1.40625 | 1 |
feincms/admin/editor.py | duointeractive/feincms | 0 | 12772530 | from feincms.admin.item_editor import ItemEditor, ItemEditorForm
from feincms.admin.tree_editor import TreeEditor, ajax_editable_boolean, \
ajax_editable_boolean_cell, django_boolean_icon
| 1.046875 | 1 |
youtube_downloader.py | SH1RL0CK/youtube_downloader | 0 | 12772531 | <gh_stars>0
#!/usr/bin/python3
from PySide2.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QFormLayout, QFileDialog, QPushButton, QCheckBox, QComboBox
from PySide2.QtGui import QPixmap
import sys, getpass, platform, time
from youtube_dl import YoutubeDL
class MainWidget(QWidget):
def __init__(self) -> ... | 2.703125 | 3 |
sdk/python/pulumi_alicloud/ess/scaling_configuration.py | pulumi/pulumi-alicloud | 42 | 12772532 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 1.460938 | 1 |
utils/Plot.py | benjimor/LiLa | 1 | 12772533 | <filename>utils/Plot.py
import plotly.offline as py
import plotly.graph_objs as go
import numpy as np
def draw(data_inf, data_sup, data_med, structure, order, limit, measure, nb_exec, aggregate):
measure_array_inf = []
for key, value in data_inf.iteritems():
measure_array_inf.append(_aggregate(value, ... | 2.453125 | 2 |
networkapi/api_network/tests/v3/sanity/allocate/test_network_v6.py | vinicius-marinho/GloboNetworkAPI | 1 | 12772534 | # -*- coding: utf-8 -*-
import json
from itertools import izip
from django.test.client import Client
from networkapi.test.test_case import NetworkApiTestCase
from networkapi.util.geral import prepare_url
fixtures_base_path = 'networkapi/api_network/fixtures/integration/%s'
class NetworksIntegrationV6TestCase(Netwo... | 1.859375 | 2 |
unstdlib/standard/string_.py | wolever/unstdlib.py | 83 | 12772535 | import re
import string
import unicodedata
from unstdlib.six import text_type, PY3, string_types, binary_type, u
from unstdlib.six.moves import xrange
if PY3:
text_type_magicmethod = "__str__"
else:
text_type_magicmethod = "__unicode__"
from .random_ import random
__all__ = [
'random_string',
'numb... | 3.234375 | 3 |
notification_sender/urls.py | juliojmphjv/spot-that-fire | 0 | 12772536 | <reponame>juliojmphjv/spot-that-fire
from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url
from notification_sender.views import sms_response
urlpatterns = [
url(r'^receive/$', sms_response),
] | 1.507813 | 2 |
tests/test_snappi_lists.py | Rangababu-R/snappi | 34 | 12772537 | import pytest
import snappi
def test_snappi_lists(api):
"""Validate SnappiList object indexing and unpacking
"""
config = api.config()
flows = config.flows.flow(name='1')
assert(flows.__class__ == snappi.FlowIter)
flow = flows[0]
flow.tx_rx.port.tx_name = 'p1'
assert(flow.__class__ ==... | 2.453125 | 2 |
imutils/utils/ResizeRight/_setup.py | JacobARose/image-utils | 0 | 12772538 | <gh_stars>0
# from distutils.core import setup #, find_packages
import sys
from setuptools import find_packages, setup
# print(sys.path)
# print(dir())
setup(
name="ResizeRight",
version="0.1dev",
packages=find_packages(include=["ResizeRight", "resize_right", "resize_right.*"]),
license="Creative Com... | 1.234375 | 1 |
examples/decompose/do_compare_ica_methods.py | fboers/jumeg | 6 | 12772539 | <filename>examples/decompose/do_compare_ica_methods.py
"""
Compute the ica object on filtered data based on the mne and on the
jumeg method.
Compare pca_mean_ and pre_whitener_ for:
mne & filtered data, jumeg & filtered data, jumeg & unfiltered data
"""
import mne
from mne.preprocessing.ica import ICA as ICA_mne
from ... | 2.515625 | 3 |
src/complicated1.py | belkale/deeplearning_playground | 0 | 12772540 | <reponame>belkale/deeplearning_playground
import sys
import math
import numpy as np
def complicated_val(x,y):
val1 = (x-3)*(x-3) + (y+4)*(y+4) + y*math.sin(x) - 16
val2 = (x+4)*(x+4) + (y-2)*(y-2) + x*math.cos(y) - 9
if val1 < 0 or val2 < 0:
return True
else:
return False
def main(argv... | 3.984375 | 4 |
transpile_shr_to_asm.py | N00byEdge/shrush | 3 | 12772541 | import sys
def dprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def read():
c = sys.stdin.read(1)
#dprint(f"Read byte '{c[0]}'")
return c
def clean_read():
while True:
v = read()
#dprint(f"clean_read: '{v[0]}'")
if v == '\n': continue
if v == ' ': ... | 2.796875 | 3 |
src/fuckery/memory.py | williamgibb/pyFuckery | 0 | 12772542 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pyFuckery - memory.py
Created on 2/12/17.
Memory object implementation. Provides memory bounds checking, as well as value enforcement.
"""
# Stdlib
import argparse
import hashlib
import json
import logging
import sys
# Third Party Code
import msgpack
# Custom Code
f... | 2.984375 | 3 |
tests/contract/test_misc.py | samuelhwilliams/github-trello-powerup | 0 | 12772543 | <filename>tests/contract/test_misc.py<gh_stars>0
"""
TESTS TO WRITE:
* API contract tests for notify/email provider, github, trello
"""
| 0.992188 | 1 |
privacy/tests/test_app/admin.py | bitlabstudio/django-privacy | 2 | 12772544 | """Admin for the ``test_app`` app."""
from django.contrib import admin
from .models import DummyProfileModel
admin.site.register(DummyProfileModel)
| 1.3125 | 1 |
boresights/analyzer/flux_calibration_file_analyzer.py | SDRAST/Data_Reduction | 0 | 12772545 |
import datetime
import logging
import h5py
from .file_analyzer import FileAnalyzer
from .flux_calibration_data_analyzer import FluxCalibrationDataAnalyzer
module_logger = logging.getLogger(__name__)
class FluxCalibrationFileAnalyzer(FileAnalyzer):
def __init__(self, file_path):
super(FluxCalibrationA... | 2.46875 | 2 |
modules/viewers/TransferFunctionEditor.py | chrisidefix/devide | 25 | 12772546 | <filename>modules/viewers/TransferFunctionEditor.py
# - make our own window control for colour-sequence bar
# - this should also have separate (?) line with HSV colour vertices
# - on this line, there should be vertical lines indicating the current
# position of all the opacity transfer function vertices
# - abstract... | 2.015625 | 2 |
Data_processing/create_station_json.py | oyvorha/TIO4905 | 0 | 12772547 | import pandas as pd
import json
file = '~/stations.xlsx'
sheet_name = 'Data'
scenarios = ['A', 'B', 'C', 'D', 'E']
flat_rate = 0.3
battery_rate = 0.7
length_time_interval = 120
stations = {}
def read_excel():
df_stations = pd.read_excel(file, sheet_name)
for index, row in df_stations.iterrows():
int... | 3.09375 | 3 |
Assignments/Assignment1/python/src/producerConsumer.py | r4ghu/CSC564-Concurrency | 0 | 12772548 | from utils import Semaphore, Thread, Buffer, execution_manager
import random
import time
class WaitForEvent:
def __init__(self, data):
self.data = data
def process(self):
print("Finished consuming event {}".format(self.data))
mutex = Semaphore(1)
items = Semaphore(0)
buffer = Buffer()
def ... | 3.359375 | 3 |
deep_tracking/deeptracking/data/sensors/sensorbase.py | birlrobotics/birlBaxter_demos | 24 | 12772549 | import abc
class SensorBase:
@abc.abstractmethod
def start(self):
pass
@abc.abstractmethod
def stop(self):
pass
@abc.abstractmethod
def intrinsics(self):
"""
return CameraParameters
:return:
"""
pass
@abc.abstractmethod
def get... | 2.890625 | 3 |
mbus/MBusRecord.py | droid4control/python-mbus | 23 | 12772550 | from ctypes import Structure, Union, c_char_p, c_double, c_int, c_byte, \
c_long, POINTER
c_byte_p = POINTER(c_byte)
class MBusString(Structure):
_fields_ = [
('value', c_byte_p),
('size', c_int),
]
class MBusValue(Union):
_fields_ = [
('real_val... | 2.609375 | 3 |