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 |
|---|---|---|---|---|---|---|
GalleryMan/utils/infoFinder.py | 0xsapphir3/GalleryMan | 9 | 42400 | <filename>GalleryMan/utils/infoFinder.py
from PyQt5.QtGui import QKeySequence, QPixmap
from GalleryMan.assets.QtHelpers import Animation, PopUpMessage
import os
from PIL import Image
from PyQt5.QtCore import QRect, Qt
from PyQt5.QtWidgets import QGraphicsScene, QGraphicsView, QLabel, QLineEdit, QShortcut, QVBoxLayout
... | 2.28125 | 2 |
emails/spiders/email-template-spider.py | ThrowsException/reallygoodemails-scraper | 0 | 42401 | import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from emails.items import ImageItem
class EmailTemplateSpire(CrawlSpider):
name = "email"
start_urls = [
'https://reallygoodemails.com/category/inaugural/welcome/',
]
rules = [
R... | 2.78125 | 3 |
gsflow/builder/controlfile_builder.py | usgs-pygsflow/pygsflow | 1 | 42402 | <reponame>usgs-pygsflow/pygsflow<filename>gsflow/builder/controlfile_builder.py
from .. import ControlFile
from . import Defaults, ControlFileDefaults
class ControlFileBuilder(object):
"""
Class for building Modflow model objects using built in Defaults.
ControlFile Builder builds a GSFLOW contro... | 2.828125 | 3 |
DataRecording/EMG&force_data recording.py | amirhosein-vedadi/GrippingForcePrediction | 0 | 42403 | from matplotlib import pyplot as plt
from collections import deque
from threading import Lock, Thread
import myo
import numpy as np
import serial
import csv
import re
import time
from datetime import datetime
## serial port and rate for reading F/T sensor data
SERIAL_PORT = 'COM1'
SERIAL_RATE = 1152... | 2.453125 | 2 |
httpcap/__main__.py | birdming22/httpcap | 0 | 42404 | <gh_stars>0
# coding=utf8
from __future__ import unicode_literals, print_function, division
import argparse
import io
import signal
import sys
import six
from httpcap import config, cleanups
from httpcap import live_cap
from httpcap.parse_pcap import parse_pcap_file, run_parser
# when press Ctrl+C
def signal_handl... | 2.5 | 2 |
Caracteriz_nubes_Anio.py | cmcuervol/Estefania | 2 | 42405 | <filename>Caracteriz_nubes_Anio.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
from datetime import datetime, timedelta
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import matplotlib.ticker as tck
import matplotlib.font_manager as fm
import m... | 2.34375 | 2 |
components/collector/src/source_collectors/junit/source_up_to_dateness.py | kargaranamir/quality-time | 33 | 42406 | """JUnit metric collector."""
from datetime import datetime
from dateutil.parser import parse
from base_collectors import SourceUpToDatenessCollector, XMLFileSourceCollector
from collector_utilities.functions import parse_source_response_xml
from collector_utilities.type import Response
class JUnitSourceUpToDatene... | 2.640625 | 3 |
frappe-bench/apps/erpnext/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py | Semicheche/foa_frappe_docker | 0 | 42407 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_ta... | 1.890625 | 2 |
polrev/campaigns/models/local.py | polrev-github/polrev-django | 1 | 42408 | from django.db import models
from django.utils.translation import gettext_lazy as _
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, ObjectList
from .state import StateCampaignPageBase
from areas.widgets.place_widgets import PlaceChooser
from offices.widgets import OfficeTypeChooser, LocalOfficeCh... | 1.820313 | 2 |
nova/tests/functional/db/test_instance_mapping.py | bopopescu/TestNova | 2 | 42409 | <reponame>bopopescu/TestNova
# 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 t... | 1.828125 | 2 |
scripts/install_html5.py | proydakov/zeptobird | 6 | 42410 | <filename>scripts/install_html5.py<gh_stars>1-10
#!/usr/bin/env python3
import os
import sys
import shutil
if len(sys.argv) < 2:
print("usage", sys.argv[0], "[install path]")
sys.exit(1)
files = []
htmls = ["html5/index.html"]
sounds = os.listdir("shared/resources/music")
bins = ["build-html5/html5/zepto... | 2.359375 | 2 |
test/python/read16PCM.py | dwaybright/g729a_python | 0 | 42411 |
method1 = []
method2 = []
with open("out.raw", "rb") as file:
byteValue = file.read(2)
while byteValue != b"":
intValueOne = int.from_bytes(byteValue, "big", signed=True)
intValueTwo = int.from_bytes(byteValue, "little", signed=True)
method1.append(intValueOne)
method2.append... | 3.046875 | 3 |
Stepper.py | low2by/holofan | 0 | 42412 | import RPi.GPIO as GPIO
import time
from PololuDriver import PololuDriver
res = 1.8
step_amount = 1
class Stepper():
def __init__(self):
self.Motor1 = PololuDriver(dir_pin=26, step_pin=20, enable_pin=21)
def step_num(self, num, dir='forward'):
self.Motor1.TurnStep(Dir=dir, steps=num, stepdela... | 3.328125 | 3 |
sdk/boost_1_30_0/libs/python/test/str.py | acidicMercury8/xray-1.0 | 2 | 42413 | """
>>> from str_ext import *
>>> def printer(*args):
... for x in args: print x,
... print
...
>>> work_with_string(printer)
['this', 'is', 'a', 'demo', 'string']
['this', 'is', 'a', 'demo string']
this<->is<->a<->demo<->string
This is a demo string
[ this is a demo string ]
2
this is a dem... | 3.140625 | 3 |
interstellar/server/exceptions.py | crazytruth/interstellar | 0 | 42414 | <gh_stars>0
from interstellar.exceptions import InterstellarError
class InterstellarAbort(InterstellarError):
status = None
def __init__(
self,
h2_status: int,
grpc_status=None,
grpc_message=None
) -> None:
self.h2_status = h2_status
super()... | 2.5625 | 3 |
hypermax/optimizer.py | 00sapo/hypermax | 107 | 42415 | import hyperopt
import csv
import json
import traceback
import os.path
from pprint import pprint
import datetime
import time
import numpy.random
import threading
import queue
import copy
import tempfile
import random
import subprocess
import concurrent.futures
import tempfile
import functools
import math
import atexit
... | 1.84375 | 2 |
src/doddq/qpe.py | tomdodd4598/doddq | 0 | 42416 | import doddq.helpers as helpers
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import HGate, PhaseGate, QFT
from typing import Callable
class GeneralizedQPEInfo:
def __init__(self, qr_eval: QuantumRegister, qr_state: QuantumRegister, circuit: QuantumCircuit) -... | 2.25 | 2 |
grow/settings/__init__.py | jpk0727/growApp | 0 | 42417 | <gh_stars>0
""" Settings for grow """
| 0.996094 | 1 |
ttools/preprocessing.py | IlyaBizyaev/ttools | 11 | 42418 | <reponame>IlyaBizyaev/ttools
"""Utilities to preprocess data."""
from . import get_logger
import numpy as np
import torch as th
__all__ = ["extract_tiles"]
LOG = get_logger(__name__)
def extract_tiles(im, tile_size=128, tile_stride=None,
drop_last=True, align=None):
"""Generator that extracts... | 2.734375 | 3 |
test/integration/dppl/target_py/mlp.py | deepppl/stanc3 | 17 | 42419 | <reponame>deepppl/stanc3<filename>test/integration/dppl/target_py/mlp.py
from stanpyro.distributions import *
from stanpyro.dppllib import sample, param, observe, factor, array, zeros, ones, empty, matmul, true_divide, floor_divide, transpose, dtype_long, dtype_float, vmap, register_network, random_module
from stanpyro... | 2.21875 | 2 |
task/urls.py | bubaley/air-drf-relation | 4 | 42420 | <reponame>bubaley/air-drf-relation<filename>task/urls.py
from rest_framework import routers
from .views import TaskViewSet
router = routers.SimpleRouter()
router.register('tasks', TaskViewSet)
urlpatterns = router.urls
| 1.585938 | 2 |
alipay/aop/api/domain/AlipayCommerceTransportTaxiDriverlevelQueryModel.py | antopen/alipay-sdk-python-all | 213 | 42421 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayCommerceTransportTaxiDriverlevelQueryModel(object):
def __init__(self):
self._channel = None
self._driver_name = None
self._driver_phone = None
self._ext_inf... | 2.09375 | 2 |
tools/RAiDER/models/plotWeather.py | EJFielding/RAiDER | 32 | 42422 | <reponame>EJFielding/RAiDER<gh_stars>10-100
"""
This set of functions is designed to for plotting WeatherModel
class objects. It is not designed to be used on its own apart
from this class.
"""
from RAiDER.interpolator import RegularGridInterpolator as Interpolator
from mpl_toolkits.axes_grid1 import make_axes_locatab... | 2.609375 | 3 |
collider_fork/data/generator.py | cryptexis/causal_inference | 1 | 42423 | import numpy as np
import pandas as pd
from .scm import SCM
class DataGenerator:
def generate(self, scm: SCM, n_samples: int, seed: int):
pass
class SimpleDataGenerator(DataGenerator):
def generate(self, scm: SCM, n_samples: int, seed: int):
"""
Generates date according to the given... | 3.0625 | 3 |
selim_sef-solution/lucid/misc/io/__init__.py | Hulihrach/RoadDetector | 4,537 | 42424 | <reponame>Hulihrach/RoadDetector
from lucid.misc.io.showing import show
from lucid.misc.io.loading import load
from lucid.misc.io.saving import save, CaptureSaveContext, batch_save
from lucid.misc.io.scoping import io_scope, scope_url
| 1.15625 | 1 |
flower/views/__init__.py | alexsilva/flower | 7 | 42425 | <gh_stars>1-10
from __future__ import absolute_import
import copy
import inspect
import re
import traceback
from base64 import b64decode
from distutils.util import strtobool
from django.conf import settings
from django.http import Http404, JsonResponse, HttpResponse
from django.shortcuts import render
from django.url... | 1.960938 | 2 |
image-similarity/hand.py | jianchengwang/todo-ml | 0 | 42426 | import cv2
image = cv2.imread("database-tea-cake/1018-1-a.jpg")
cv2.imshow("palm",image) #to view the palm in python
cv2.waitKey(0)
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,60,65,apertureSize = 3)
cv2.imshow("edges",edges)
cv2.waitKey(0)
edges = cv2.bitwise_not(edges)
cv2.imshow("change ... | 3.3125 | 3 |
inference_video_v2.py | apark263/arXiv2020-RIFE | 0 | 42427 | <gh_stars>0
import time
import os
import cv2
import torch
import numpy as np
from tqdm import tqdm
from torch.nn import functional as F
import warnings
import _thread
from queue import Queue, Empty
from model.pytorch_msssim import ssim_matlab
from model.RIFE_HDv3 import Model
from absl import app
from absl import flags... | 1.835938 | 2 |
docker_interface/plugins/__init__.py | tillahoffmann/docker_interface | 32 | 42428 | # Copyright 2018 Spotify AB
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, soft... | 1.132813 | 1 |
rl/agents/policy/random_policy_agent.py | ManuelMeraz/ReinforcementLearning | 1 | 42429 | #!/usr/bin/env python3
import numpy
from rl.agents.policy.policy_agent import PolicyAgent
class Random(PolicyAgent):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def act(self, state: numpy.ndarray, available_actions: numpy.ndarray):
"""
Uses a uniform rando... | 3.34375 | 3 |
bot/commands.py | SuRoryz/surbot-osu | 0 | 42430 | import PP_Calculator
from pppredict.predict import predict
from util import str_to_dict, mod_convert, add_spaces
from re import findall
from lang_init import Initialization
from get_local import get_sample
import users
import maps
class Commands:
def __init__(self):
pass
''' +====-----------==------... | 2.328125 | 2 |
container_service_extension/configure_cse.py | YiouZhu1010/container-service-extension | 0 | 42431 | <filename>container_service_extension/configure_cse.py<gh_stars>0
# container-service-extension
# Copyright (c) 2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
import pika
from pyvcloud.vcd.api_extension import APIExtension
from pyvcloud.vcd.client import BasicLoginCredentials
from pyvcl... | 1.242188 | 1 |
kita/tests/test_models.py | FelixTheC/beak_emailer_list | 0 | 42432 | <reponame>FelixTheC/beak_emailer_list
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@created: 20.09.20
@author: felix
"""
from django.core.exceptions import ValidationError
from django.test import TestCase
from kita.models import Kita
class KitaTest(TestCase):
def setUp(self) -> None:
pass
def... | 2.296875 | 2 |
lib_fslock/datamart_fslock/unix.py | VIDA-NYU/auctus | 15 | 42433 | <reponame>VIDA-NYU/auctus
"""File locking implementation using flock(2).
"""
# This whole module exists as stand-alone, without the Prometheus metrics
# https://pypi.org/project/fslock/
import contextlib
import fcntl
import logging
import multiprocessing
import os
import prometheus_client
import signal
import time
... | 2.578125 | 3 |
Intermediate-Python/04-Loops.py | vntborgesjr/Python-Fundamentals | 0 | 42434 | # ---------------------------------------------------
# Intermediate Python - Loops
# 22 set 2020
# VNTBJR
# ---------------------------------------------------
#
# Load packages
library(reticulate)
# while loop -------------------------------------------
# Basic while loop
# Initialize offset
offset = 8
# Code... | 3.609375 | 4 |
tests/test_rocket_powered_landing.py | yuokamoto/PythonRobotics | 11 | 42435 | from unittest import TestCase
import sys
sys.path.append("./AerialNavigation/rocket_powered_landing/")
from AerialNavigation.rocket_powered_landing import rocket_powered_landing as m
print(__file__)
class Test(TestCase):
def test1(self):
m.show_animation = False
m.main()
| 2.296875 | 2 |
clash-of-code/reverse/number_pyramid.py | jonasnic/codingame | 30 | 42436 | <reponame>jonasnic/codingame
n = int(input())
for i in range(0, n):
print(str(n) * (i + 1))
| 3.53125 | 4 |
pyscript/script/doubleRule.py | Accelsnow/phonogenesis | 1 | 42437 | <gh_stars>1-10
from __future__ import annotations
import logging
import random
from abc import ABCMeta, abstractmethod
from enum import Enum, IntEnum
from typing import List, Dict
from script import Word, Rule, Sound, Template, Generator, GenMode
from serializable import Serializable
LOGGER = logging.getLogger("app.... | 2.796875 | 3 |
odoo-13.0/addons/website_sale_delivery/controllers/main.py | VaibhavBhujade/Blockchain-ERP-interoperability | 0 | 42438 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http, _
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.exceptions import UserError
class WebsiteSaleDelivery(WebsiteSale):
@http.route(['... | 2.109375 | 2 |
vsts/vsts/tfvc/v4_1/models/tfvc_label_request_data.py | kenkuo/azure-devops-python-api | 0 | 42439 | <reponame>kenkuo/azure-devops-python-api
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------... | 1.992188 | 2 |
pytorch3d/implicitron/dataset/json_index_dataset.py | ParikhKadam/pytorch3d | 0 | 42440 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# 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.
import functools
import gzip
import hashlib
import json
import logging
import os
import random
import warnings
... | 2.171875 | 2 |
app/__init__.py | Ferocity/flask-oidc-example | 0 | 42441 | <reponame>Ferocity/flask-oidc-example
import os
from flask import Flask, request, current_app, json
from flask_bootstrap import Bootstrap
from config import Config
from flask_pyoidc import OIDCAuthentication
from flask_pyoidc.provider_configuration import ProviderConfiguration, ClientMetadata
def parse_oidc_config(l... | 2.65625 | 3 |
discord_bot.py | PrivatPinguin/discord_bot_example | 1 | 42442 | import discord
import os
import requests
import json
# init bot
client = discord.Client()
# API request
def get_json():
response = requests.get('api_request_goes_here')
jSon_data = json.loads{response} #alternate json data here
# console:: bot ready
@client.event
async def on_ready():
print('Logged in as {0.user... | 2.765625 | 3 |
playstream.py | magnetikonline/docker-acestream-server | 97 | 42443 | #!/usr/bin/env python3
import argparse
import hashlib
import json
import re
import signal
import subprocess
import sys
import time
import urllib.request
DEFAULT_SERVER_HOSTNAME = "127.0.0.1"
DEFAULT_SERVER_PORT = 6878
SERVER_POLL_TIME = 2
SERVER_STATUS_STREAM_ACTIVE = "dl"
def exit_error(message):
print(f"Erro... | 2.53125 | 3 |
Software/qlocktoo/timewords/__init__.py | tfeldmann/QlockToo | 1 | 42444 | <reponame>tfeldmann/QlockToo<filename>Software/qlocktoo/timewords/__init__.py
from qlocktoo.assets import assets_rc
from .timewords import TimeWordsApp
| 1.171875 | 1 |
multispinsys/CalculationsCode/TimeCorrelation.py | Marcupio/SpinProgram | 0 | 42445 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 13:10:41 2018
@author: crius
"""
import Hamiltonians as H
import numpy as np
import tools as t
import spintensor as st
import spinops as so
import time
import Expand as ex
from matplotlib import pyplot as plt
exp = np.exp
N = 8
nlegs = 4
S = 0.5
c = np.sqrt(2)
Jcu... | 1.882813 | 2 |
server/src/weaverbird/backends/pandas_executor/steps/convert.py | JeremyJacquemont/weaverbird | 54 | 42446 | <reponame>JeremyJacquemont/weaverbird<filename>server/src/weaverbird/backends/pandas_executor/steps/convert.py
from pandas import DataFrame
from weaverbird.backends.pandas_executor.types import DomainRetriever, PipelineExecutor
from weaverbird.pipeline.steps import ConvertStep
from .utils.cast import cast_to_bool, ca... | 2.53125 | 3 |
hillmaker/testing/test_obsim_log.py | misken/hillmaker | 2 | 42447 | import pandas as pd
from pandas import Timestamp
import hillmaker
file_stopdata = '../data/unit_stop_log_Experiment1_Scenario138_Rep17.csv'
scenario_name = 'log_unitocc_test_5'
in_fld_name = 'EnteredTS'
out_fld_name = 'ExitedTS'
cat_fld_name = 'Unit'
start_analysis = '12/12/2015 00:00'
end_analysis = '12/19/2021 00:... | 2.5 | 2 |
augment_features.py | Ads2020Group6/gender-pay-gap-modelling | 0 | 42448 | import pandas as pd
import numpy as np
def augment(data):
data['MalePercent'] = (data['MaleLowerQuartile'] +
data['MaleLowerMiddleQuartile'] + data['MaleUpperMiddleQuartile'] +
data['MaleTopQuartile']) * .25
data['FemalePercent'] = (data['FemaleLowerQuarti... | 3.21875 | 3 |
hooks/post_gen_project.py | tartiflette/cookiecutter-tartiflette-plugin | 1 | 42449 | #!/usr/bin/env python
import os
from typing import List, Union
_PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
def _remove_files(files: Union[List[str], str]) -> None:
"""
Removes the list of files provided.
:param files: list of filepath to remove
:type files: Union[List[str], str]
"""
... | 2.609375 | 3 |
app/dashboard/views/mfa_cancel.py | fariszr/app | 5 | 42450 | <reponame>fariszr/app
from flask import render_template, flash, redirect, url_for, request
from flask_login import login_required, current_user
from app.dashboard.base import dashboard_bp
from app.dashboard.views.enter_sudo import sudo_required
from app.extensions import db
from app.models import RecoveryCode
@dashb... | 2.1875 | 2 |
apimux/__init__.py | zeeguu-ecosystem/apimux | 0 | 42451 | <reponame>zeeguu-ecosystem/apimux
import sys
from apimux.log import logger
logger.debug("==== API Multiplexer imported ====")
major = sys.version_info.major
minor = sys.version_info.minor
micro = sys.version_info.micro
logger.debug("Running Python version %s.%s.%s" % (major, minor, micro))
| 1.90625 | 2 |
apps/user/views.py | AlexFire-Dev/OnlineChat | 0 | 42452 | import json
import channels.layers
from asgiref.sync import async_to_sync
from django.conf import settings
from django.core.paginator import Paginator
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse, reverse_lazy
from django.views.gene... | 1.898438 | 2 |
kYPython/Django/myblog/blog/views.py | kyaing/KDYSample | 10 | 42453 | <filename>kYPython/Django/myblog/blog/views.py
from django.shortcuts import render, render_to_response, get_object_or_404
from .models import Blog, BlogType
# Create your views here.
def blog_list(request):
context = {}
context['blogs'] = Blog.objects.all()
return render_to_response('blog_list.html', conte... | 2.25 | 2 |
HPCWatchdog/__init__.py | brockpalen/hpc-watchdog | 0 | 42454 | # /usr/bin/python3
import logging
import sched
import signal
import sys
import time
from functools import partial
import watchdog.events
import watchdog.observers
from watchdog.observers.polling import PollingObserver as PollingObserver
from GlobusTransfer import GlobusTransfer
from .args import Args
from .handler ... | 2.21875 | 2 |
py/qxcomscroll/web/playground.py | wthie/qxcomscroll | 0 | 42455 | <gh_stars>0
#! /usr/bin/env python
#-*- coding: iso-8859-1 -*-
"""
playground - the basic object which serves as the root
author : <NAME>, wth
last edit: wth, 21.03.2011
modhistory:
03.06.2009 - wth, thinking about disconnecting
21.03.2011 - wth, reworked for qxcomscroll
"""
import os... | 1.976563 | 2 |
Foundation/magic_method/del_method.py | youaresherlock/PythonPractice | 0 | 42456 | <gh_stars>0
#!usr/bin/python
# -*- coding:utf8 -*-
"""
__del__:析构方法, 当对象在内存中被释放时,自动触发此方法
"""
class Foo:
def __del__(self):
print("__del__")
obj = Foo() # 程序结束自动会被回收
| 3.125 | 3 |
python_modules/dagster/dagster/core/types/builtin_enum.py | vishvananda/dagster | 0 | 42457 | <reponame>vishvananda/dagster
from enum import Enum
class BuiltinEnum(Enum):
ANY = 'Any'
BOOL = 'Bool'
FLOAT = 'Float'
INT = 'Int'
PATH = 'Path'
STRING = 'String'
| 2.609375 | 3 |
backend/backend/settings/prod.py | ealmonte32/api | 0 | 42458 | from backend.settings.base import *
if DEBUG:
ALLOWED_HOSTS += [
'localhost'
]
DASH_URL = 'https://dash.wott.io'
if IS_DASH or DEBUG:
ALLOWED_HOSTS += [
'dash.wott.io'
]
if IS_API or DEBUG:
ALLOWED_HOSTS += [
'api.wott.io'
]
if IS_MTLS_API or DEBUG:
ALLOWED_HOSTS... | 1.476563 | 1 |
src/static.py | topores/UnifiedTrader | 0 | 42459 | import datetime
class AppContext():
def __init__(self):
self.invoker_fault = False
self.executor_fault = False
self.position_reducer_fault = False
self.logger_fault = False
self.app_exit = False
self.info = {}
class Action():
CLOSE = -1
HOLD = 0
LONG... | 2.734375 | 3 |
train.py | djangbahevans/Image-Classifier | 0 | 42460 | import argparse
import os
import sys
import torch
from torch import nn, optim
from torch.optim import optimizer
from torchvision import datasets, models, transforms
parser = argparse.ArgumentParser(description="Trains a neural network")
parser.add_argument('data_dir', metavar='dir', type=str,
help... | 2.640625 | 3 |
django/views/defaults.py | egenerat/gae-django | 3 | 42461 | <reponame>egenerat/gae-django
from django import http
from django.views.decorators.csrf import requires_csrf_token
from django.template import Context, RequestContext, loader
# This can be called when CsrfViewMiddleware.process_view has not run, therefore
# need @requires_csrf_token in case the template needs {... | 2.515625 | 3 |
ledger/__main__.py | Funk66/ledger | 0 | 42462 | from .client import run
run()
| 1.007813 | 1 |
Clases/Lab03/GraphTimeBinarySearch.py | PaulAlexander19/LabADAGrupoB | 0 | 42463 | # Ejercicio 04
import time
import matplotlib.pyplot as plt
# Algoritmo
def binarySearch(numbers, n):
numElements = len(numbers)
if(numElements == 1):
return (n == numbers[0])
mitad = numElements // 2
if(numbers[mitad] == n):
return True
elif (n < numbers[mitad]):
return... | 3.59375 | 4 |
grail/app.py | farwydi/animated-octo-robot | 0 | 42464 | # -*- coding: utf-8 -*-
import wx
from grail import Grail
from pages import LoginPage, MainFrame
from protocol import GrailProtocol
class MainFrameLogic(MainFrame):
def __init__(self, login, password):
super().__init__(None)
# self.m_notebook1.SetBackgroundColour(wx.NullColour)
self.g... | 2.1875 | 2 |
rest_framework_security/otp/migrations/0001_initial.py | RubenEu/django-rest-framework-security | 7 | 42465 | # Generated by Django 2.2.4 on 2020-06-29 10:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USE... | 1.710938 | 2 |
bot/constants.py | LockPickersUnited/BeltBot | 0 | 42466 | from os import getenv
from dataclasses import dataclass
from collections import ChainMap
from dotenv import load_dotenv
from bot.structs import CaseInsensitiveDict
load_dotenv()
MY_NAME = "LPUBeltbot"
MY_REDDIT_PW = getenv("BELTBOT_REDDIT_PW")
MY_REDDIT_CLIENT_ID = getenv("BELTBOT_REDDIT_CID")
MY_REDDIT_SECRET... | 2.359375 | 2 |
cnn.py | teralion/explore-ml-cnn | 1 | 42467 | import mnist
import numpy as np
from PIL import Image
from conv import Conv3x3
from maxpool import MaxPool2
from softmax import Softmax
train_images = mnist.train_images()[:100]
train_labels = mnist.train_labels()[:100]
test_images = mnist.test_images()[:1000]
test_labels = mnist.test_labels()[:1000]
conv = Conv3x3(8... | 3.234375 | 3 |
services/simcct/tests/test_api_base.py | NeuralDev-io/arclytics_simcct | 2 | 42468 | <filename>services/simcct/tests/test_api_base.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# arclytics_sim
# base.py
#
# Attributions:
# [1]
# -----------------------------------------------------------------------------
__author__ = [
'<NAME> <@codeninj... | 1.867188 | 2 |
Stephanie/local_libs/search_module.py | JeremyARussell/stephanie-va | 866 | 42469 | class SearchModule:
def __init__(self):
pass
def search_for_competition_by_name(self, competitions, query):
m, answer = self.search(competitions, attribute_name="caption", query=query)
if m == 0:
return False
return answer
def search_for_competition_by_code(self... | 2.984375 | 3 |
1. Python/1. Getting Started with Python/5. print_variables.py | theparitoshkumar/Data-Structures-Algorithms-using-python | 1 | 42470 | <gh_stars>1-10
""" Write a program to display values of variables in Python. """
message = "Keep Smiling!"
print(message)
userNo = 101
print("User No is ", userNo)
gender = 'M'
print("Gender: ",gender)
| 3.6875 | 4 |
test/test_metadata.py | rockyplum/vampy-host | 16 | 42471 | <reponame>rockyplum/vampy-host<gh_stars>10-100
import vampyhost as vh
plugin_key = "vamp-test-plugin:vamp-test-plugin"
##!!! could use: plugin version
def test_list():
plugins = vh.list_plugins()
if plugin_key not in plugins:
print("Test plugin " + plugin_key + " not installed or not returned by enu... | 2.515625 | 3 |
simpletype/utils/Supply.py | rzalegal/pytypes | 1 | 42472 | <gh_stars>1-10
from random import randint, random, choice
from string import ascii_letters
class Supply:
__max_val = 10
__size = 5
@staticmethod
def of_size(size):
Supply.__size = size
return Supply
@staticmethod
def with_max(max_val):
Supply.__max_val = max_val
... | 3.15625 | 3 |
trader/backtest/position.py | Ricky294/trader | 0 | 42473 | <gh_stars>0
from trader.core.model import Position, Balance
from trader.core.const.trade_actions import LONG, SHORT
class BacktestPosition(Position):
__slots__ = "times", "prices", "quantities"
def __init__(
self,
symbol: str,
entry_time: int,
entry_price: flo... | 2.96875 | 3 |
utils/language_modeling/__init__.py | Lednik7/data_fusion | 1 | 42474 | <gh_stars>1-10
from .data import (
get_dataloaders,
Collator
)
from .train import Trainer
from .model import get_model
__all__ = ['get_dataloaders', 'Collator', 'Trainer', 'get_model'] | 1.390625 | 1 |
encode_gaps_as_characters.py | harmsm/phylo_tools | 0 | 42475 | #!/usr/bin/env python3
__description__ = \
"""
Take an alignment and create an R-readable table in which each site is mapped
a gap (0) or non-gap (1) for each taxon. This can then be fed to APE for a
character reconstruction.
"""
__author__ = "<NAME>"
__date__ = "2015-07-28"
__usage__ = "encode_gaps_as_characters.py... | 2.953125 | 3 |
deploy.py | T8840/configCenter | 0 | 42476 | # -*- coding: utf-8 -*-
"""
:author: T8840
:tag: Thinking is a good thing!
纸上得来终觉浅,绝知此事要躬行!
:description:
1.部署相关信息来自于nacos配置
{
"server_info": {
"host": "10.201.5.161",
"port":22,
"user" : "user",
... | 2.390625 | 2 |
utils/database.py | JustUndertaker/tuanzi_bot | 8 | 42477 | <filename>utils/database.py
from peewee import SqliteDatabase
from configs.pathConfig import DATABASE_PATH
from modules.user_info import UserInfo
from modules.group_info import GroupInfo
from modules.user_level import UserLevel
from modules.plugin_info import PluginInfo
from nonebot.log import logger
from modules.due... | 2.109375 | 2 |
flask_app/commands.py | loganathanengrr/FlaskBasicRestfulAPI | 0 | 42478 | <gh_stars>0
import click
from flask.cli import with_appcontext
from .extensions import db
@click.command(name='create_tables')
@with_appcontext
def create_tables():
try:
db.create_all()
return 'Created'
except Exception as e:
raise | 1.867188 | 2 |
src/checkrs/reliability.py | timothyb0912/checkrs | 2 | 42479 | # -*- coding: utf-8 -*-
"""
Functions for plotting reliability diagrams: smooths of simulated vs observed
outcomes on the y-axis against predicted probabilities on the x-axis.
"""
from __future__ import absolute_import
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sbn
from .plot_utils import _l... | 3.046875 | 3 |
scripts/api-lambda-tasks/background_handler.py | knowmetools/km-api-deployment | 1 | 42480 | """
An AWS Lambda function used to run periodic background jobs on ECS.
The complication with running these tasks is that we need to run them on
the same version of the Docker image that the web servers are currently
running on.
"""
import logging
import boto3
from utils import env_list, env_param
# Logging setup... | 2.65625 | 3 |
pype/hosts/resolve/utility_scripts/__test_subprocess.py | kalisp/pype | 0 | 42481 | #! python3
# -*- coding: utf-8 -*-
import os
from pypeapp import execute, Logger
from pype.hosts.resolve.utils import get_resolve_module
log = Logger().get_logger("Resolve")
CURRENT_DIR = os.getenv("RESOLVE_UTILITY_SCRIPTS_DIR", "")
python_dir = os.getenv("PYTHON36_RESOLVE")
python_exe = os.path.normpath(
os.path... | 2.171875 | 2 |
faker_tax/de_DE/__init__.py | mastacheata/faker_tax | 0 | 42482 | # -*- coding: utf-8 -*-
from .. import Provider as TaxProvider
class Provider(TaxProvider):
"""
A Faker provider for the Empto project
"""
def tax_id(self):
"""
Returns a random generated Tax ID
"""
return "DE" + str(self.bothify('#########'))
def tax_number(sel... | 2.953125 | 3 |
xunit/repo.bzl | tomaszstrejczek/rules_dotnet_3rd_party | 1 | 42483 | <reponame>tomaszstrejczek/rules_dotnet_3rd_party<filename>xunit/repo.bzl<gh_stars>1-10
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_library", "core_resource")
filegroup(
name = "core_common",
srcs = [
":src/common/ExceptionExtensions.cs",
":src/common/Guard.cs",
":src/common/Te... | 1.234375 | 1 |
preprocessing/libs/networks/DCFNet_bk.py | vision4robotics/UDAT | 81 | 42484 | from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
from libs.modules.FuseBlock import MakeFB
from .resnet_dilation import resnet50, resnet101, Bottleneck, conv1x1
BN_MOMENTUM = 0.1
logger = logging.getLogger(__name__)
def conv3x3(in_planes, out_plan... | 2.265625 | 2 |
authentik/flows/api/bindings.py | BeryJu/passbook | 15 | 42485 | <reponame>BeryJu/passbook<filename>authentik/flows/api/bindings.py
"""Flow Binding API Views"""
from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ModelViewSet
from authentik.core.api.used_by import UsedByMixin
from authentik.flows.api.stages import StageSerializer
from authenti... | 1.765625 | 2 |
lecture5/recording_utils.py | zodoctor/lectures-fall2018 | 4 | 42486 | import pyaudio
import wave
import time
def record_wav_file(CHUNK = 1024,
FORMAT = pyaudio.paInt16,
CHANNELS = 2,
RATE = 44100,
RECORD_SECONDS = 5,
WAVE_OUTPUT_FILENAME = "voice.wav"):
"""
Creates a wav audio fi... | 3.265625 | 3 |
python/Util/test.py | zhclwr/demo | 0 | 42487 | res = []
with open('test.txt', mode='r', encoding="utf-8") as f:
for line in f:
arr = line.split()
print(arr)
res.append(arr[1])
r = '\t'.join(res)
with open('res.txt', mode='w', encoding="utf-8") as f:
# print(r)
f.write(r) | 3.078125 | 3 |
meowth/settings.py | bheuair/Professeurchen | 1 | 42488 | <gh_stars>1-10
class GuildConfig:
def __init__(self, data):
self._data = data
self.prefix = self.settings['prefix']
self.offset = self.settings['offset']
self.regional_pkmn = self.settings['regional']
self.has_configured = self.settings['done']
@property
def settings... | 2.359375 | 2 |
blog/migrations/0013_auto_20191023_1808.py | mogubudu/django_blog_backend | 0 | 42489 | <filename>blog/migrations/0013_auto_20191023_1808.py
# Generated by Django 2.2.6 on 2019-10-23 15:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0012_remove_tag_image'),
]
operations = [
migrations.RemoveField(
model_nam... | 1.359375 | 1 |
drf_admin/apps/monitor/serializers/crud.py | guohaihan/myproject | 228 | 42490 | # -*- coding: utf-8 -*-
"""
@author : <NAME>
@github : https://github.com/tianpangji
@software : PyCharm
@file : crud.py
@create : 2020/12/9 20:44
"""
from django.contrib.contenttypes.models import ContentType
from easyaudit.models import CRUDEvent
from rest_framework import serializers
class CRUDSerializer... | 2.0625 | 2 |
__init__.py | benjaoming/sushi-chef-elejandria-libros | 0 | 42491 | # -*- coding: utf-8 -*-
"""Top-level package for Elejandria Libros chef."""
__author__ = """Learning Equality"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| 0.8125 | 1 |
Interview-Preparation/Facebook/Explore/3-Trees-and-Graphs/Trees-09-Convert-Binary-Search-Tree-to-Sorted-Doubly-Linked-List.py | shoaibur/SWE | 1 | 42492 | <gh_stars>1-10
"""
# Definition for a Node.
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
"""
class Solution:
def treeToDoublyList(self, root: 'Node') -> 'Node':
if not root: return None
nodes = []
... | 3.5625 | 4 |
py/solutions/goorm/financial_crisis.py | aid95/algorithm-diary | 0 | 42493 | def solution(salaries: list[int]) -> int:
return sorted(salaries)[1]
if __name__ == '__main__':
user_input = input()
param = [int(x) for x in user_input.split()]
print(solution(salaries=param))
| 3.671875 | 4 |
pyPing.py | michael080808/pyPing | 0 | 42494 | """
ICMP(Internet Control Message Protocol) - Echo Request:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0|0|0|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|1|1|2|2|2|2|2|2|2|2|2|2|3|3|
|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|2|3|4|5|6|7|8|9|0|1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+... | 1.648438 | 2 |
test/test_to_delete_contact_from_group.py | Nadezhda-Sokolova/Python_training_from_software-testing.ru | 0 | 42495 | import random
from model.contact import Contact
from model.group import Group
def test_to_delete_contact_from_group(app, db ,check_ui):
app.group.open_groups_page()
if len(db.get_group_list()) == 0:
app.group.create()
app.group.fill_group_form(Group(name='group for adding of contact'))
... | 2.578125 | 3 |
spreadsplug/web/__init__.py | atomotic/spreads | 1 | 42496 | import gzip
import logging
import logging.handlers
import os
from cStringIO import StringIO as IO
from spreads.vendor.huey import SqliteHuey
from spreads.vendor.huey.consumer import Consumer
from spreads.vendor.pathlib import Path
from flask import Flask, request
from spreads.plugin import (HookPlugin, SubcommandHook... | 2.0625 | 2 |
src/pyrin/users/internal/__init__.py | wilsonGmn/pyrin | 0 | 42497 | # -*- coding: utf-8 -*-
"""
users internal package.
"""
from pyrin.packaging.base import Package
class InternalUsersPackage(Package):
"""
internal users package class.
"""
NAME = __name__
COMPONENT_NAME = 'users.internal.component'
DEPENDS = ['pyrin.admin',
'pyrin.validator',
... | 1.367188 | 1 |
data_preprocessing/cvat_annotation_converter.py | Hoclor/CoSADUV-Contextual-Saliency-for-Detecting-Anomalies-in-UAV-Video | 4 | 42498 | """A tool to convert annotation files created with CVAT into ground-truth style images
for machine learning. The initial code was copied from:
https://gist.github.com/cheind/9850e35bb08cfe12500942fb8b55531f
originally written for a similar purpose for the tool BeaverDam (which produces json),
and was then adapted f... | 2.8125 | 3 |
爬虫小demo/22 JDPython.py | lb2281075105/Python-Spider | 713 | 42499 | import time
from selenium import webdriver
from lxml import etree
driver = webdriver.PhantomJS(executable_path='./phantomjs-2.1.1-macosx/bin/phantomjs')
# 获取第一页的数据
def get_html():
url = "https://detail.tmall.com/item.htm?id=531993957001&skuId=3609796167425&user_id=268451883&cat_id=2&is_b=1&rn=71b9b0aeb233411c4f5... | 3.109375 | 3 |