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 |
|---|---|---|---|---|---|---|
dashboard_analytics/tasks/transaction_processor.py | Astewart1510/pvt-algoranddashboard | 0 | 6800 | <filename>dashboard_analytics/tasks/transaction_processor.py
from dashboard_analytics.models import AccountType, InstrumentType, Account, Transaction
def process_json_transactions(transactions):
for txn in transactions:
print(txn["pk"]) | 2.09375 | 2 |
MuonGun/resources/scripts/histreduce.py | hschwane/offline_production | 1 | 6801 | <reponame>hschwane/offline_production<filename>MuonGun/resources/scripts/histreduce.py
#!/usr/bin/env python
"""
Add all (potentially gigantic) histograms in a group of files.
"""
import dashi
import tables
import os, sys, operator, shutil
from optparse import OptionParser
parser = OptionParser(usage="%prog [OPTIONS... | 2.359375 | 2 |
procrastinate/exceptions.py | ignaciocabeza/procrastinate | 0 | 6802 | <filename>procrastinate/exceptions.py
import datetime
class ProcrastinateException(Exception):
"""
Unexpected Procrastinate error.
"""
def __init__(self, message=None):
if not message:
message = self.__doc__
super().__init__(message)
class TaskNotFound(ProcrastinateExcep... | 2.96875 | 3 |
config/settings/local.py | vyshakTs/STORE_MANAGEMENT_SYSTEM | 0 | 6803 | from .base import *
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'SMS',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
}... | 1.515625 | 2 |
question3.py | haojunsng/foodpanda-dataeng | 0 | 6804 | from functions import get_df, write_df
import geopy
from geopy import distance
"""
The function question3 takes in the latitude and longitude of potential distress locations,
and returns the nearest port with essential provisions such as water, fuel_oil and diesel.
"""
def question3(dataset_name, latitude, longitude)... | 3.671875 | 4 |
plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/case.py | valory-xyz/agents-aea | 0 | 6805 | <reponame>valory-xyz/agents-aea<filename>plugins/aea-cli-benchmark/aea_cli_benchmark/case_acn_communication/case.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 <NAME>
# Copyright 2018-2021 Fetch.AI Limited
#
# L... | 1.703125 | 2 |
examples/pybullet/vr_kuka_setup.py | q4a/bullet3 | 12 | 6806 | import pybullet as p
#p.connect(p.UDP,"192.168.86.100")
p.connect(p.SHARED_MEMORY)
p.resetSimulation()
objects = [p.loadURDF("plane.urdf", 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000)]
objects = [p.loadURDF("samurai.urdf", 0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000)]
objects = [p... | 2.21875 | 2 |
genomics_algo/utilities/string_cmp.py | SvoONs/genomics_algo | 0 | 6807 | <filename>genomics_algo/utilities/string_cmp.py<gh_stars>0
def longest_common_prefix(s1: str, s2: str) -> str:
"""
Finds the longest common prefix (substring) given two strings
s1: First string to compare
s2: Second string to compare
Returns:
Longest common prefix between s1 and s2
>>... | 3.5 | 4 |
whyqd/parsers/wrangling_parser.py | whythawk/whyqd | 17 | 6808 | from __future__ import annotations
from typing import Optional, Dict, List, Union, Type, TYPE_CHECKING
from datetime import date, datetime
import pandas as pd
import numpy as np
import re
import locale
try:
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
except locale.Error:
# Readthedocs has a problem, but dif... | 2.28125 | 2 |
0x02-python-import_modules/2-args.py | FatChicken277/holbertonschool-higher_level_programming | 0 | 6809 | #!/usr/bin/python3
def args(args):
lenn = len(args) - 1
if lenn == 0:
print("0 arguments.")
elif lenn == 1:
print("{0} argument:".format(lenn))
print("{0}: {1}".format(lenn, args[lenn]))
elif lenn > 1:
print("{0} arguments:".format(lenn))
for i in range(lenn):
... | 3.859375 | 4 |
taurex/data/profiles/__init__.py | rychallener/TauREx3_public | 10 | 6810 | """
These modules contain sub-modules related to defining various profiles in a model
""" | 1.132813 | 1 |
day-2/part_b.py | yuetsin/AoC | 0 | 6811 | <gh_stars>0
#!/usr/bin/env python3
import re
def get_input() -> list:
with open('./input', 'r') as f:
return [v for v in [v.strip() for v in f.readlines()] if v]
lines = get_input()
count = 0
for line in lines:
lower, upper, char, password = re.split(r'-|: | ', line)
lower, upper = int(lower) ... | 3.5 | 4 |
src/tone.py | devanshslnk/HelpOff | 2 | 6812 | from __future__ import print_function
import json
from os.path import join, dirname
from watson_developer_cloud import ToneAnalyzerV3
from watson_developer_cloud.tone_analyzer_v3 import ToneInput
from pprint import pprint
# If service instance provides API key authentication
# service = ToneAnalyzerV3(
# ## url i... | 2.15625 | 2 |
hcloud/servers/domain.py | usmannasir/hcloud-python | 1 | 6813 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from hcloud.core.domain import BaseDomain
from hcloud.helpers.descriptors import ISODateTime
class Server(BaseDomain):
"""Server Domain
:param id: int
ID of the server
:param name: str
Name of the server (must be unique per project and a valid... | 2.234375 | 2 |
AutomationFramework/tests/interfaces/test_if_subif.py | sbarguil/Testing-framework | 1 | 6814 | <reponame>sbarguil/Testing-framework<filename>AutomationFramework/tests/interfaces/test_if_subif.py
import pytest
from AutomationFramework.page_objects.interfaces.interfaces import Interfaces
from AutomationFramework.tests.base_test import BaseTest
class TestInterfacesSubInterfaces(BaseTest):
test_case_file = 'if... | 2.234375 | 2 |
keystone/common/sql/migrate_repo/versions/001_add_initial_tables.py | sanket4373/keystone | 0 | 6815 | <reponame>sanket4373/keystone
# Copyright 2012 OpenStack Foundation
#
# 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 ... | 1.710938 | 2 |
boa3_test/examples/ico.py | DanPopa46/neo3-boa | 0 | 6816 | <gh_stars>0
from typing import Any, List, Union
from boa3.builtin import NeoMetadata, metadata, public
from boa3.builtin.contract import Nep17TransferEvent
from boa3.builtin.interop.blockchain import get_contract
from boa3.builtin.interop.contract import GAS, NEO, call_contract
from boa3.builtin.interop.runtime import... | 1.570313 | 2 |
emotion_recognition.py | Partaourides/SERN | 10 | 6817 | import os
# Restrict the script to run on CPU
os.environ ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = ""
# Import Keras Tensoflow Backend
# from keras import backend as K
import tensorflow as tf
# Configure it to use only specific CPU Cores
config = tf.ConfigProto(intra_op_parallelism_thre... | 2.171875 | 2 |
dashboard/rpc/alias.py | flaree/Toxic-Cogs | 0 | 6818 | <gh_stars>0
import discord
from redbot.core.bot import Red
from redbot.core.commands import commands
from redbot.core.utils.chat_formatting import humanize_list
from .utils import permcheck, rpccheck
class DashboardRPC_AliasCC:
def __init__(self, cog: commands.Cog):
self.bot: Red = cog.bot
... | 2.109375 | 2 |
train.py | hafezgh/music_classification | 1 | 6819 | import torch
DEVICE = 'cuda'
import math
import torch.optim as optim
from model import *
import os
import copy, gzip, pickle, time
data_dir = './drive/MyDrive/music_classification/Data'
classes = os.listdir(data_dir+'/images_original')
def fit(model, train_loader, train_len, optimizer, criterion):
model.train()
... | 2.390625 | 2 |
dlk/core/schedulers/__init__.py | cstsunfu/dlkit | 0 | 6820 | <filename>dlk/core/schedulers/__init__.py
# Copyright 2021 cstsunfu. 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.390625 | 2 |
doc/samples/pos.py | m4ta1l/doit | 1,390 | 6821 | def task_pos_args():
def show_params(param1, pos):
print('param1 is: {0}'.format(param1))
for index, pos_arg in enumerate(pos):
print('positional-{0}: {1}'.format(index, pos_arg))
return {'actions':[(show_params,)],
'params':[{'name':'param1',
'shor... | 2.671875 | 3 |
projectq/backends/_qracksim/_simulator_test.py | vm6502q/ProjectQ | 1 | 6822 | # Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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 app... | 1.710938 | 2 |
app/deps.py | jshwi/jss | 1 | 6823 | <reponame>jshwi/jss<filename>app/deps.py<gh_stars>1-10
"""
app.deps
========
Register dependencies that are not part of a ``Flask`` extension.
"""
from flask import Flask
from redis import Redis
from rq import Queue
def init_app(app: Flask) -> None:
"""Register application helpers that are not ``Flask-`` extensi... | 1.742188 | 2 |
uncertainty/util/__init__.py | sangdon/intern2020_cocal | 0 | 6824 | from util.args import *
from util.logger import Logger
| 1.171875 | 1 |
com_reader.py | plusterm/plusterm | 2 | 6825 | # from wx.lib.pubsub import pub
from pubsub import pub
import serial
import threading
import queue
import time
class ComReaderThread(threading.Thread):
'''
Creates a thread that continously reads from the serial connection
Puts result as a tuple (timestamp, data) in a queue
'''
def __init__(self... | 2.875 | 3 |
docker/app/app.py | ganeshkumarsv/datadog-cloudfoundry-buildpack | 5 | 6826 | <reponame>ganeshkumarsv/datadog-cloudfoundry-buildpack
from flask import Flask
from datadog import statsd
import logging
import os
# This is a small example application
# It uses tracing and dogstatsd on a sample flask application
log = logging.getLogger("app")
app = Flask(__name__)
# The app has two routes, a bas... | 2.40625 | 2 |
Data Structure using Python/Linked_List/2linked_list1.py | shubhamsah/OpenEDU | 1 | 6827 | # Lets create a linked list that has the following elements
'''
1. FE
2. SE
3. TE
4. BE
'''
# Creating a Node class to create individual Nodes
class Node:
def __init__(self,data):
self.__data = data
self.__next = None
def get_data(self):
return self.__data
... | 3.953125 | 4 |
monai/networks/blocks/selfattention.py | function2-llx/MONAI | 1 | 6828 | <gh_stars>1-10
# Copyright (c) MONAI Consortium
# 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... | 2.171875 | 2 |
api/tests/opentrons/commands/test_protocol_commands.py | mrakitin/opentrons | 0 | 6829 | <reponame>mrakitin/opentrons
import pytest
from opentrons.commands import protocol_commands
@pytest.mark.parametrize(
argnames="seconds,"
"minutes,"
"expected_seconds,"
"expected_minutes,"
"expected_text",
argvalues=[
[10, 0, 10, 0, "Delaying for 0 m... | 2.578125 | 3 |
tests/test_histogram_source.py | ess-dmsc/just-bin-it | 0 | 6830 | from unittest.mock import patch
import pytest
from just_bin_it.endpoints.sources import HistogramSource
from tests.doubles.consumer import StubConsumer
TEST_MESSAGE = b"this is a byte message"
INVALID_FB = b"this is an invalid fb message"
class TestHistogramSource:
@pytest.fixture(autouse=True)
def prepare... | 2.484375 | 2 |
lctools/shortcuts.py | novel/lc-tools | 5 | 6831 | import getopt
import sys
from libcloud.compute.types import NodeState
from lc import get_lc
from printer import Printer
def lister_main(what, resource=None,
extension=False, supports_location=False, **kwargs):
"""Shortcut for main() routine for lister
tools, e.g. lc-SOMETHING-list
@param what: ... | 2.578125 | 3 |
tests/test_flash_vl.py | andr1976/thermo | 380 | 6832 | <reponame>andr1976/thermo
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
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 de... | 1.140625 | 1 |
ex38.py | YunMeMeThaw/python_exercises | 0 | 6833 | <reponame>YunMeMeThaw/python_exercises<gh_stars>0
ten_things = "Apples Oranges cows Telephone Light Sugar"
print ("Wait there are not 10 things in that list. Let's fix")
stuff = ten_things.split(' ')
more_stuff = {"Day", "Night", "Song", "Firebee",
"Corn", "Banana", "Girl", "Boy"}
while len(stuff) !=10:
next_on... | 3.890625 | 4 |
var/spack/repos/builtin/packages/diffmark/package.py | player1537-forks/spack | 11 | 6834 | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Diffmark(AutotoolsPackage):
"""Diffmark is a DSL for transforming one string to another.""... | 1.5625 | 2 |
bbp/comps/irikura_gen_srf.py | ZhangHCFJEA/bbp | 28 | 6835 | #!/usr/bin/env python
"""
Copyright 2010-2019 University Of Southern California
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.21875 | 2 |
core/tests/test_models.py | EthanMarrs/digit2 | 0 | 6836 | """test_models.py: runs tests on the models for digit."""
import pytest
from core.models import (Grade,
Subject,
Question,
Comment,
Option,
Topic,
Block,
... | 2.921875 | 3 |
betterbib/__init__.py | tbabej/betterbib | 0 | 6837 | <filename>betterbib/__init__.py
# -*- coding: utf-8 -*-
#
from __future__ import print_function
from betterbib.__about__ import (
__version__,
__author__,
__author_email__,
__website__,
)
from betterbib.tools import (
create_dict,
decode,
pybtex_to_dict,
pybtex_to_bibtex_string,
... | 2.09375 | 2 |
base/views.py | omololevy/my_portfolio | 2 | 6838 | from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.mail import EmailMessage
from django.conf import settings
from django.template.loader imp... | 2.140625 | 2 |
radioLib/pastebin/pastebin.py | hephaestus9/Radio | 1 | 6839 | <reponame>hephaestus9/Radio
#!/usr/bin/env python
#############################################################################
# Pastebin.py - Python 3.2 Pastebin API.
# Copyright (C) 2012 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | 1.726563 | 2 |
app/requests.py | seron-ux/News-app | 1 | 6840 | <gh_stars>1-10
import urllib.request,json
from .models import News
import requests
News = News
# Getting api key
api_key = None
# Getting the news base url
base_url = None
base_url2 = None
def configure_request(app):
global api_key,base_url,base_url2
api_key = app.config['NEWS_API_KEY']
base_url = app.c... | 2.9375 | 3 |
leetcode/151_reverse _words_in_a_string.py | caoxudong/code_practice | 1 | 6841 | """
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
For C programmers: Try to solve it in-place in O(1) space.
Clarification:
* What constitutes a word?
A sequence of non-space characters constitutes a word.
* Could the inp... | 4.03125 | 4 |
toontown/uberdog/DistributedInGameNewsMgr.py | LittleNed/toontown-stride | 3 | 6842 | import socket, datetime, os
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from direct.distributed.DistributedObject import DistributedObject
from toontown.toonbase import ToontownGlobals
from toontown.uberdog import InGameNewsResponses
class DistributedInGameNewsMgr(DistributedObject):... | 2.140625 | 2 |
Day10/loops.py | azeemchaudhrry/30DaysofPython | 0 | 6843 | <filename>Day10/loops.py
# Day 10 Loops
from countries import *
# While Loop
# count = 0
# while count < 5:
# if count == 3:
# break
# print(count)
# count = count + 1
# numbers = [0,2,3,4,5,6,7,8,9,10]
# for number in numbers:
# print(number)
# language = 'Python'
# for letter in language:
... | 3.828125 | 4 |
tessera-server/tessera/views_api.py | Dimas625/tessera | 379 | 6844 | <reponame>Dimas625/tessera<filename>tessera-server/tessera/views_api.py
# -*- mode:python -*-
import flask
import json
import logging
from datetime import datetime
import inflection
from functools import wraps
from flask import request, url_for
from werkzeug.exceptions import HTTPException
from .client.api.model imp... | 2.1875 | 2 |
modules/aws_service.py | Darkcybe/attack_range | 1 | 6845 | <gh_stars>1-10
import sys
import re
import boto3
from botocore.exceptions import ClientError
import uuid
import time
import yaml
import os
def get_instance_by_name(ec2_name, config):
instances = get_all_instances(config)
for instance in instances:
str = instance['Tags'][0]['Value']
if str == ec... | 2.3125 | 2 |
pystacknet/metrics.py | KevinMichaelSchindler/pystacknet | 0 | 6846 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 18:33:58 2018
@author: <NAME>
metrics and method to check metrics used within StackNet
"""
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score , mean_squared_log_error #regression metrics
from sklearn.metrics import roc_auc_sco... | 2.40625 | 2 |
check_logstash_pipeline.py | stdevel/nagios-plugins | 0 | 6847 | #!/usr/bin/env python
# coding=utf-8
# vim:ts=4:sts=4:sw=4:et
#
# Author: <NAME>
# Date: 2017-11-24 21:10:35 +0100 (Fri, 24 Nov 2017)
#
# https://github.com/harisekhon/nagios-plugins
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
#... | 1.429688 | 1 |
dags/mailsdag.py | rvacaru/airflow-training-skeleton | 0 | 6848 | <filename>dags/mailsdag.py
# -*- coding: utf-8 -*-
#
# 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 ... | 2.28125 | 2 |
appengine-compat/exported_appengine_sdk/google/storage/speckle/proto/jdbc_type.py | speedplane/python-compat-runtime | 26 | 6849 | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | 1.929688 | 2 |
GestiRED/views.py | osabogal10/GestiREDBackend | 0 | 6850 | from django.http import HttpResponse
from django.core.mail import send_mail
import json
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from GestiRED.models import User
from GestiRED.models import QualityControl, Phase, Resource, ResourceType,PhaseType
from django.core import se... | 1.898438 | 2 |
ext_modules/_maix_nn/example/yolo2_camera.py | sipeed/python3-maix | 93 | 6851 | <gh_stars>10-100
from maix import nn
from PIL import Image, ImageDraw, ImageFont
from maix import display, camera
import time
from maix.nn import decoder
def draw_rectangle_with_title(draw, box, disp_str, bg_color=(255, 0, 0, 255), font_color=(255, 255, 255, 255)):
# draw = ImageDraw.Draw(img)
font = Imag... | 2.15625 | 2 |
tests/test_metadata_options.py | Fatal1ty/mashumaro | 394 | 6852 | from dataclasses import dataclass, field
from datetime import date, datetime, time, timezone
from pathlib import Path
from typing import Any, Dict, Optional, Union
import ciso8601
import pytest
from mashumaro import DataClassDictMixin
from mashumaro.exceptions import UnserializableField
from mashumaro.types import Se... | 2.328125 | 2 |
vendor/github.com/tensorflow/tensorflow/tensorflow/python/ops/list_ops.py | owennewo/kfserving | 2 | 6853 | # Copyright 2018 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.34375 | 2 |
tests/test_dump.py | flaeppe/astunparse | 189 | 6854 | import ast
import re
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import astunparse
from tests.common import AstunparseCommonTestCase
class DumpTestCase(AstunparseCommonTestCase, unittest.TestCase):
def assertASTEqual(self, dump1, dump2):
# undo the ... | 2.53125 | 3 |
src/django/giraffe/blat/management/commands/reset_app.py | addgene/giraffe | 4 | 6855 | <gh_stars>1-10
from django.core.management.base import AppCommand, CommandError
from django.core.management.sql import sql_reset
from django.core.management.color import no_style
from django.db import connections
class Command(AppCommand):
help = "**********\nThis command resets data for any django app, the differ... | 2.34375 | 2 |
webBlog/apps.py | JordanBRoberts/python-theBand | 0 | 6856 | <gh_stars>0
from django.apps import AppConfig
class WebblogConfig(AppConfig):
name = 'webBlog'
| 1.195313 | 1 |
requires.py | lydaaa/fzutils | 1 | 6857 | <reponame>lydaaa/fzutils
# coding:utf-8
'''
@author = super_fazai
@File : requires.py
@Time : 2016/8/3 12:59
@connect : <EMAIL>
'''
install_requires = [
'ipython',
'wheel',
'utils',
'db',
'greenlet==0.4.13',
'web.py==0.40.dev1',
'pytz',
'requests',
'selenium==3.8.0', # 3.... | 1.21875 | 1 |
m15_dos/dos.py | venkatarjun/Python3 | 80 | 6858 | <gh_stars>10-100
import subprocess
import requests
import argparse
from concurrent.futures import ThreadPoolExecutor
from time import sleep
from datetime import datetime
ICMP_ATTACK = "ICMP"
HTTP_ATTACK = "HTTP"
valid_attacks = {HTTP_ATTACK, ICMP_ATTACK}
parser = argparse.ArgumentParser(description="DoS HTTP")
parser... | 2.65625 | 3 |
maestro/backends/django/contrib/signals.py | estudio89/maestro-python | 0 | 6859 | <gh_stars>0
from django.apps import apps
from django.db import models
from django.db.models.signals import post_save, pre_delete
from typing import Type, Optional, List, cast, TYPE_CHECKING
from maestro.backends.django.settings import maestro_settings
from maestro.backends.django.contrib.factory import create_django_da... | 1.992188 | 2 |
top/urls.py | pbexe/nextbike-top | 0 | 6860 | from django.urls import include, path
from .views import home, bike
urlpatterns = [
path("", home),
path("bike/<int:number>", bike)
] | 1.789063 | 2 |
Scripts/ReduceFragments.py | mike72353/FragFeatureNet | 1 | 6861 | """
Remove Fragments not in Knowledgebase
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2019, Hong Kong University of Science and Technology"
__license__ = "3-clause BSD"
from argparse import ArgumentParser
import numpy as np
import pickle
parser = ArgumentParser(description="Build Files... | 2.453125 | 2 |
client/core/tests/billing_tests.py | vbohinc/CommunityCellularManager | 0 | 6862 | """Tests for core.billing.
Run this test from the project root
$ nosetests core.tests.billing_tests
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of ... | 2.265625 | 2 |
data_interrogator/admin/views.py | s-i-l-k-e/django-data-interrogator | 0 | 6863 | <reponame>s-i-l-k-e/django-data-interrogator
from django.contrib.auth.decorators import user_passes_test
from django.utils.decorators import method_decorator
from data_interrogator.admin.forms import AdminInvestigationForm, AdminPivotTableForm
from data_interrogator.interrogators import Allowable
from data_interrogato... | 1.882813 | 2 |
configs/pspnet/pspnet_r18-d8_512x512_80k_loveda.py | heytanay/mmsegmentation | 11 | 6864 | <filename>configs/pspnet/pspnet_r18-d8_512x512_80k_loveda.py
_base_ = './pspnet_r50-d8_512x512_80k_loveda.py'
model = dict(
backbone=dict(
depth=18,
init_cfg=dict(
type='Pretrained', checkpoint='open-mmlab://resnet18_v1c')),
decode_head=dict(
in_channels=512,
channels... | 1.210938 | 1 |
bba/objects.py | TheGenocides/BBA | 3 | 6865 | <reponame>TheGenocides/BBA
from typing import Dict, Any
class ResponseObject:
def __init__(self, data: Dict[str, Any]):
self.payload = data
for k, v in data.items():
setattr(self, k, v) | 2.34375 | 2 |
apps/greencheck/forms.py | BR0kEN-/admin-portal | 0 | 6866 | from django import forms
from django.forms import ModelForm
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from .choices import ActionChoice
from .choices import StatusApproval
from .models import GreencheckIp
from .models import GreencheckIpApprove
from .models impor... | 2.203125 | 2 |
apps/utils/format/url_format.py | think-wang/osroom | 1 | 6867 | #!/usr/bin/env python
# -*-coding:utf-8-*-
from tld import get_tld
__author__ = "<NAME>"
def get_domain(url):
'''
获取url中的全域名
:param url:
:return:
'''
res = get_tld(url, as_object=True)
return "{}.{}".format(res.subdomain, res.tld) | 2.5625 | 3 |
ipamanager/entities.py | Tjev/freeipa-manager | 0 | 6868 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-3-Clause
# Copyright © 2017-2019, GoodData Corporation. All rights reserved.
"""
FreeIPA Manager - entity module
Object representations of the entities configured in FreeIPA.
"""
import os
import re
import voluptuous
import yaml
from abc imp... | 2.015625 | 2 |
test/test_catalog_manager.py | weknowtraining/athena-glue-service-logs | 133 | 6869 | # pylint: skip-file
from athena_glue_service_logs.catalog_manager import BaseCatalogManager
def test_class_init(mocker):
mocker.patch.multiple(BaseCatalogManager, __abstractmethods__=set())
base_catalog = BaseCatalogManager('us-west-2', 'dbname', 'tablename', 's3://somewhere')
assert base_catalog.databas... | 1.945313 | 2 |
unsorted/pythonsnippets_0013.py | fiddlerwoaroof/sandbox | 0 | 6870 | from twisted.internet import reactor
reactor.listenTCP(8789, factory)
reactor.run() | 1.398438 | 1 |
__main__.py | SHUcream00/MLBPitchVisual | 0 | 6871 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def visualize(dataframe, balltype):
df = dataframe
#Filter by balltype
res = df[df["pitch_type"] == balltype]
#Group by results
groups = res.groupby("description")
for name, group in groups:
if name ==... | 3.375 | 3 |
shape_similarity.py | Toonwire/infancy_eye_tracking | 0 | 6872 | # -*- coding: utf-8 -*-
"""
Created on Sat May 25 13:17:49 2019
@author: Toonw
"""
import numpy as np
def vlen(a):
return (a[0]**2 + a[1]**2)**0.5
def add(v1,v2):
return (v1[0]+v2[0], v1[1]+v2[1])
def sub(v1,v2):
return (v1[0]-v2[0], v1[1]-v2[1])
def unit_vector(v):
vu = v / np.linalg.norm(v)
... | 2.859375 | 3 |
apps/chats/apps.py | aldwyn/effigia | 1 | 6873 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class ChatsConfig(AppConfig):
name = 'apps.chats'
def ready(self):
from actstream import registry
registry.register(*self.get_models())
| 1.734375 | 2 |
utils/ghost.py | JayJJChen/LoveXueXiQiangGuo | 3 | 6874 | <gh_stars>1-10
import os
import time
from utils.eye import Eye
from utils.finger import Finger
class Ghost:
"""class to navigate the app, with Eye and Finger"""
def __init__(self, adb_path, temp_path, sleep_sec=2):
self.eye = Eye(adb_path, temp_path)
self.finger = Finger(adb_path, sleep_sec=... | 2.984375 | 3 |
src_taxonomy/bubble_tree_map.py | sanja7s/SR_Twitter | 0 | 6875 | <filename>src_taxonomy/bubble_tree_map.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import random
from ete2 import Tree, TreeStyle, NodeStyle, faces, AttrFace, CircleFace, TextFace
def layout(node):
if not node.is_root():
# Add node name to laef nodes
#N = AttrFace("name", fsize=14, fgcolor="black")
#faces... | 3.421875 | 3 |
compass/core/_scrapers/member.py | MrNoScript/compass-interface-core | 0 | 6876 | <reponame>MrNoScript/compass-interface-core
from __future__ import annotations
import re
import time
from typing import get_args, Literal, TYPE_CHECKING, Union
from lxml import html
from compass.core.interface_base import InterfaceBase
from compass.core.logger import logger
from compass.core.schemas import member as... | 1.960938 | 2 |
quran_text/urls.py | Quran-Tafseer/tafseer_api | 16 | 6877 | <filename>quran_text/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('',
view=views.SuraListView.as_view(), name='sura-list'),
path('<int:sura_num>/<int:number>/',
view=views.AyahTextView.as_view(), name='ayah-detail'),
path('<int:sura_num>/<int:number>',
... | 1.882813 | 2 |
konnection/settings/local.py | IanSeng/CMPUT404_PROJECT | 0 | 6878 | <filename>konnection/settings/local.py
from konnection.settings.base import *
from pathlib import Path
import os
import dotenv
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# SECURITY WARNING: don't run with debug turned on in production!
DE... | 1.921875 | 2 |
main.py | PotentialParadox/PyReparm | 0 | 6879 | <gh_stars>0
import random
from evaluation import Evaluator
from generator import generator
from mutate import mutateset
from deap import base
from deap import creator
from deap import tools
from parameter_group import ParameterGroup
import gaussian_output
from analysis import Analysis
from gaussian_input import Gaussia... | 1.976563 | 2 |
pyx12/test/test_x12context.py | arenius/pyx12 | 1 | 6880 | import unittest
#import tempfile
try:
from StringIO import StringIO
except:
from io import StringIO
import pyx12.error_handler
from pyx12.errors import EngineError # , X12PathError
import pyx12.x12context
import pyx12.params
from pyx12.test.x12testdata import datafiles
class X12fileTestCase(unittest.TestCas... | 2.421875 | 2 |
repo/script.module.liveresolver/lib/liveresolver/resolvers/finecast.py | Hades01/Addons | 3 | 6881 | <reponame>Hades01/Addons<filename>repo/script.module.liveresolver/lib/liveresolver/resolvers/finecast.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import re,urlparse,cookielib,os,urllib
from liveresolver.modules import client,recaptcha_v2,control,constants, decryptionUtils
from liveresolver.modules.log_utils import log
c... | 1.984375 | 2 |
src/robotide/publish/__init__.py | crylearner/RIDE3X | 1 | 6882 | <filename>src/robotide/publish/__init__.py<gh_stars>1-10
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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.apach... | 1.984375 | 2 |
app.py | pizzapanther/google-actions-python-example | 9 | 6883 | #!/usr/bin/env python
import os
import json
import tornado.ioloop
import tornado.log
import tornado.web
from google.oauth2 import id_token
from google.auth.transport import requests as google_requests
import jwt
import requests
API_KEY = os.environ.get('OPEN_WEATHER_MAP_KEY', None)
PROJECT_ID = os.environ.get('PRO... | 2.5 | 2 |
ProsperFlask/{{cookiecutter.project_name}}/tests/conftest.py | EVEprosper/ProsperCookiecutters | 0 | 6884 | <filename>ProsperFlask/{{cookiecutter.project_name}}/tests/conftest.py
# AUTOGENERATED BY: ProsperCookiecutters/ProsperFlask
# TEMPLATE VERSION: {{cookiecutter.template_version}}
# AUTHOR: {{cookiecutter.author_name}}
"""PyTest fixtures and modifiers"""
import pytest
from {{cookiecutter.library_name}}.endpoints impo... | 1.445313 | 1 |
zoloto/coords.py | RealOrangeOne/yuri | 7 | 6885 | from typing import Iterator, NamedTuple, Tuple
from cached_property import cached_property
from cv2 import Rodrigues
from pyquaternion import Quaternion
class Coordinates(NamedTuple):
"""
:param float x: X coordinate
:param float y: Y coordinate
"""
x: float
y: float
class ThreeDCoordinate... | 3.390625 | 3 |
azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/bms_container_query_object.py | JonathanGailliez/azure-sdk-for-python | 1 | 6886 | # coding=utf-8
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes ... | 1.703125 | 2 |
ia870/iagradm.py | rdenadai/ia870p3 | 5 | 6887 | <filename>ia870/iagradm.py<gh_stars>1-10
# -*- encoding: utf-8 -*-
# Module iagradm
def iagradm(f, Bdil=None, Bero=None):
from ia870 import iasubm,iadil,iaero,iasecross
if Bdil is None: Bdil = iasecross()
if Bero is None: Bero = iasecross()
y = iasubm( iadil(f,Bdil),iaero(f,Bero))
return y
| 2.421875 | 2 |
backend/api/tests/test_models/test_utils/test_ranking_suffixes.py | ChristchurchCityWeightlifting/lifter-api | 0 | 6888 | <filename>backend/api/tests/test_models/test_utils/test_ranking_suffixes.py
import pytest
from api.models.utils import rankings
@pytest.fixture
def test_data():
return [1, 11, 101]
def test_rankings(test_data):
"""Tests if ranking works
e.g. 1 returns 1st
11 returns 11th
101 return 10... | 2.640625 | 3 |
web/web-lemonthinker/src/app/app.py | NoXLaw/RaRCTF2021-Challenges-Public | 2 | 6889 | <filename>web/web-lemonthinker/src/app/app.py
from flask import Flask, request, redirect, url_for
import os
import random
import string
import time # lemonthink
clean = time.time()
app = Flask(__name__)
chars = list(string.ascii_letters + string.digits)
@app.route('/')
def main():
return open("index.html").read()... | 2.53125 | 3 |
aprendizado/codewars/descending_order.py | renatodev95/Python | 0 | 6890 | # Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.
# Função que recebe um número inteiro (não negativo) como argumento e o retorna com os dígitos em ordem des... | 4.28125 | 4 |
dmarc_storage.py | Schramp/dmarc-monitoring | 1 | 6891 | import sqlite3
import os
import datetime
__all__ = ['DMARCStorage', 'totimestamp']
def totimestamp(datetime_object):
if datetime_object.utcoffset() is not None:
utc_naive = datetime_object.replace(tzinfo=None) - datetime_object.utcoffset()
else:
utc_naive = datetime_object
return (utc_nai... | 2.546875 | 3 |
setup.py | mcdruid/sumologic-python-sdk | 4 | 6892 | from setuptools import setup, find_packages
setup(
name="sumologic-sdk",
version="0.1.9",
packages=find_packages(),
install_requires=['requests>=2.2.1'],
# PyPI metadata
author="<NAME>, <NAME>",
author_email="<EMAIL>, <EMAIL>",
description="Sumo Logic Python SDK",
license="PSF",
... | 1.210938 | 1 |
docs/conf.py | urm8/django-translations | 100 | 6893 | <reponame>urm8/django-translations
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup -------------------------... | 1.8125 | 2 |
skorecard/metrics/__init__.py | orchardbirds/skorecard-1 | 0 | 6894 | <reponame>orchardbirds/skorecard-1
"""Import required Metric."""
from .metrics import IV_scorer
__all__ = ["IV_scorer"]
| 0.996094 | 1 |
src/waldur_core/core/tests/helpers.py | geant-multicloud/MCMS-mastermind | 26 | 6895 | import copy
from django.conf import settings
from django.test.utils import override_settings
from rest_framework import status, test
class PermissionsTest(test.APITransactionTestCase):
"""
Abstract class for permissions tests.
Methods `get_urls_configs`, `get_users_with_permission`,
`get_users_witho... | 2.390625 | 2 |
data/benchmark.py | Gummary/denet | 343 | 6896 | <reponame>Gummary/denet
"""
CutBlur
Copyright 2020-present NAVER corp.
MIT license
"""
import os
import glob
import data
class BenchmarkSR(data.BaseDataset):
def __init__(self, phase, opt):
root = opt.dataset_root
self.scale = opt.scale
dir_HQ, dir_LQ = self.get_subdir()
self.HQ_pa... | 2.328125 | 2 |
pytglib/api/types/update_chat_is_pinned.py | iTeam-co/pytglib | 6 | 6897 | <gh_stars>1-10
from ..utils import Object
class UpdateChatIsPinned(Object):
"""
A chat was pinned or unpinned
Attributes:
ID (:obj:`str`): ``UpdateChatIsPinned``
Args:
chat_id (:obj:`int`):
Chat identifier
is_pinned (:obj:`bool`):
New value of is_p... | 2.84375 | 3 |
tests/test_api.py | jairhenrique/todoist-python | 0 | 6898 | import io
import time
import todoist
def test_stats_get(api_endpoint, api_token):
api = todoist.api.TodoistAPI(api_token, api_endpoint)
response = api.completed.get_stats()
assert 'days_items' in response
assert 'week_items' in response
assert 'karma_trend' in response
assert 'karma_last_upda... | 2.15625 | 2 |
setup.py | dylancrockett/iot.io | 0 | 6899 | from setuptools import setup
import iotio
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="iot.io",
version=iotio.__version__,
packages=["iotio"],
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
description="A management API for connecting and managi... | 1.539063 | 2 |