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 |
|---|---|---|---|---|---|---|
admin/tests/test_layers_vectortiles.py | rbovard/c2cgeoportal | 43 | 25300 | # pylint: disable=no-self-use
import re
import pytest
from . import AbstractViewsTests, factory_build_layers, get_test_default_layers
@pytest.fixture(scope="function")
@pytest.mark.usefixtures("dbsession", "transact")
def layer_vectortiles_test_data(dbsession, transact):
del transact
from c2cgeoportal_com... | 1.851563 | 2 |
SSRF/dns.py | cxosmo/curated-wordlists | 2 | 25301 | #encoding: utf-8
from __future__ import print_function
from builtins import str
import ipaddress
import datetime
import os
import sys
from twisted.names import client, dns, server, hosts as hosts_module, root, cache, resolve
from twisted.internet import reactor
from twisted.python.runtime import platform
TTL = 0
dict ... | 2.5 | 2 |
relevanceai/_api/endpoints/admin/__init__.py | RelevanceAI/RelevanceAI | 21 | 25302 | from .admin import AdminClient
| 1.09375 | 1 |
kotdbot.py | tvezet/KoTDBot | 0 | 25303 | #!/usr/bin/env python
#from difflib import SequenceMatcher
import discord
import numpy as np
from joblib import dump, load
import sys
import os
import math
helpText = "Tell me the sizes of two of your gems and i will calculate the optimal size of the third gem based on the current ritual bonus. If running a ritual wi... | 2.8125 | 3 |
lib/ezdxf/sections/abstract.py | tapnair/DXFer | 4 | 25304 | <filename>lib/ezdxf/sections/abstract.py
# Purpose: entity section
# Created: 13.03.2011
# Copyright (C) 2011, <NAME>
# License: MIT License
from __future__ import unicode_literals
__author__ = "mozman <<EMAIL>>"
from itertools import islice
from ..lldxf.tags import TagGroups, DXFStructureError
from ..lldxf.classifie... | 2.15625 | 2 |
spacy-textdescriptives/subsetters.py | HLasse/spacy-textdescriptives | 0 | 25305 | <filename>spacy-textdescriptives/subsetters.py
"""Helpers to subset an extracted dataframe"""
readability_cols = [
"flesch_reading_ease",
"flesch_kincaid_grade",
"smog",
"gunning_fog",
"automated_readability_index",
"coleman_liau_index",
"lix",
"rix",
]
dependency_cols = [
"depende... | 1.898438 | 2 |
aoc/day22.py | martinhenstridge/adventofcode2020 | 0 | 25306 | <filename>aoc/day22.py
from . import util
def get_decks(lines):
player = 0
cards = []
for line in lines:
if line.startswith("Player"):
player = int(line[-2])
elif line:
cards.append(int(line))
else:
yield player, cards
player = 0
... | 3.421875 | 3 |
src/test_trained_webcam.py | sumit-chavan/Face-Recognition-Model | 0 | 25307 | <filename>src/test_trained_webcam.py
import math
from sklearn import neighbors
import os
import os.path
import pickle
from PIL import Image, ImageDraw
import face_recognition
from face_recognition.face_recognition_cli import image_files_in_folder
import cv2
#from webapp import db
#from DB import Actor
ALLOWED_EXTENSIO... | 2.84375 | 3 |
history/views.py | light-white/meeting | 0 | 25308 | <gh_stars>0
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from history.models import *
# Create your views here.
def history(request):
historylist = History.objects.all()
... | 2.453125 | 2 |
predictor.py | GlebovVL/Energo | 0 | 25309 | <filename>predictor.py
from datetime import timedelta
import random
import pandas as pd
class Predictor:
def __init__(self,avarii, coords):
self.avarii = avarii
self.coords=coords
pass
def got_prediction(self,date,length,where,probtype):
avarii_count = ((self.avarii.oblast==where... | 3.046875 | 3 |
predictit/market.py | harryposner/pypredictit | 4 | 25310 | <filename>predictit/market.py
import datetime as dt
from decimal import Decimal
import pytz
from .utils import concurrent_get
class Market(object):
"""Interact with PredictIt markets
This class handles market-level transactions with PredictIt,
including getting market risk, payouts, and contract IDs.
... | 3.0625 | 3 |
prep_data/sketchycococrops_to_tfrecord.py | leosampaio/scene-designer | 9 | 25311 | <reponame>leosampaio/scene-designer
import argparse
import json
import os
import re
import glob
import imageio
import skimage.transform as sk_transform
import numpy as np
import tensorflow as tf
import utils
def default_hparams():
hps = utils.hparams.HParams(
image_size=256,
min_object_size=0.05... | 1.914063 | 2 |
Solutions/String/L409_LongestPalindrome.py | ufolux/PythonLeetCodeSolution | 0 | 25312 | class Solution:
def longestPalindrome(self, s: str) -> int:
d = {}
for c in s:
if c not in d:
d[c] = 1
else:
d[c] = d[c] + 1
res = 0
for _, n in d.items():
res += n - (n & 1)
return res + 1 if res < len(s) e... | 3.28125 | 3 |
lessweb/__init__.py | qorzj/lessweb | 17 | 25313 | <filename>lessweb/__init__.py<gh_stars>10-100
"""lessweb: 用最python3的方法创建web apps"""
__version__ = '0.3.3'
__author__ = [
'qorzj <<EMAIL>>',
]
__license__ = "MIT"
# from . import application, context, model, storage, webapi
from .application import interceptor, Application
from .context import Context, Request,... | 1.789063 | 2 |
notification/admin.py | horacexd/clist | 1 | 25314 | <filename>notification/admin.py
from pyclist.admin import BaseModelAdmin, admin_register
from notification.models import Notification, Task
@admin_register(Notification)
class NotificationAdmin(BaseModelAdmin):
list_display = ['coder', 'method', 'before', 'period', 'last_time', 'modified']
list_filter = ['met... | 2.046875 | 2 |
google_cloud_storage_cls/utils/gcp_constant.py | mayurdhamecha-crest/ta_cloud_exchange_plugins | 0 | 25315 | """GCP Storage Constant."""
locations_list = [
"US",
"EU",
"ASIA",
"ASIA1",
"EUR4",
"NAM4",
"NORTHAMERICA-NORTHEAST1",
"NORTHAMERICA-NORTHEAST2",
"US-CENTRAL1",
"US-EAST1",
"US-EAST4",
"US-WEST1",
"US-WEST2",
"US-WEST3",
"US-WEST4",
"SOUTHAMERICA-EAST1",
... | 1.515625 | 2 |
lazytorch/layers/__init__.py | mgmalek/lazytorch | 0 | 25316 | from .conv import LazyExpansionConv2d, LazyReductionConv2d
from .conv_norm_activ import ConvNormActivation, LazyConvNormActivation
from .depth_sep_conv import (
DepthwiseConv2d,
PointwiseConv2d,
DepthSepConv2d,
LazyDepthwiseConv2d,
LazyPointwiseConv2d,
LazyExpansionPointwiseConv2d,
LazyReduc... | 1.125 | 1 |
functions_legacy/PathsCauchy.py | dpopadic/arpmRes | 6 | 25317 | <filename>functions_legacy/PathsCauchy.py
from numpy import ones, cumsum, diff, tile, r_
from numpy.random import rand
from scipy.stats import t
def PathsCauchy(x0,mu,sigma,tau,j_):
# This function generates paths for the process x such that the increments
# dx are iid Cauchy distributed.
# INPUTS
# ... | 2.6875 | 3 |
main.py | Elvira521feng/InfoNews | 0 | 25318 | from flask import current_app
from flask_script import Manager
from flask_migrate import MigrateCommand
from info import create_app
# 创建应用
app = create_app("dev")
# 创建管理器
mgr = Manager(app)
# 添加迁移命令
mgr.add_command("mc", MigrateCommand)
# 生成超级管理员命令
@mgr.option("-u", dest="username")
@mgr.option("-p", dest="password"... | 2.625 | 3 |
hwtHls/ssa/basicBlock.py | Nic30/hwtHls | 8 | 25319 | from typing import List
from hwtHls.ssa.context import SsaContext
from hwtHls.ssa.instr import SsaInstrBranch, SsaInstr
from hwtHls.ssa.phi import SsaPhi
class SsaBasicBlock():
"""
Basic Block from Static Single Assignment (SSA) normal form of code.
:ivar label: label for debug purposes
:ivar predec... | 2.921875 | 3 |
parser/team12/src/EXPRESION/EXPRESION_RELACIONAL/Expresion_Relacional.py | webdev188/tytus | 35 | 25320 | <filename>parser/team12/src/EXPRESION/EXPRESION_RELACIONAL/Expresion_Relacional.py
import sys, os.path
import datetime
nodo_dir = (os.path.abspath(os.path.join(os.path.dirname(__file__), '..','..')) + '\\ENTORNO\\')
sys.path.append(nodo_dir)
from Tipo import Data_Type
# **********************************************... | 2.578125 | 3 |
app/models.py | evantoh/news-article | 0 | 25321 |
class Articles:
def __init__(self,id,name,author, title, description, url, urlToImage,publishedAt):
self.id = id
self.name = name
self.author = author
self.title = title
self.description = description
self.url = url
self.urlToImage = urlToImage
... | 3.40625 | 3 |
fppv/cli.py | kdheepak/fppv | 0 | 25322 | #!/usr/bin/env python
"""cli module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import click
import traceback
import importlib
from . import version
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.command(context_settings=CONTE... | 2.125 | 2 |
main.py | kozistr/naver-movie-rate-prediction | 4 | 25323 | import os
import time
import argparse
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from config import get_config, export_config
from model.textcnn import TextCNN
from model.textrnn import TextRNN
from sklearn.model_selection import train_test_split
from dataloader import Word2VecEmbeddings, Doc2Vec... | 2.6875 | 3 |
tests/test_config.py | sidorov-as/flake8-adjustable-complexity | 13 | 25324 | import pytest
from flake8.exceptions import ExecutionError
from flake8_adjustable_complexity.config import DEFAULT_CONFIG
@pytest.mark.parametrize(
('args', 'max_mccabe_complexity'),
[
(['--max-mccabe-complexity=5'], 5),
(['--max-adjustable-complexity=10'], 10),
([], DEFAULT_CONFIG.ma... | 2.390625 | 2 |
Allswap_djangoREST/backend/allswap/accounts/views.py | yds05238/AllSwap_Backend | 2 | 25325 | from rest_framework import generics
| 1.054688 | 1 |
src/plugins/time_zone_db/executor.py | AmeyKamat/MEERA | 20 | 25326 | <filename>src/plugins/time_zone_db/executor.py
import os
from datetime import datetime
import requests
class TimeZoneDBPlugin:
def __init__(self, config):
super(TimeZoneDBPlugin, self).__init__()
self.config = config
def execute(self, context):
entities = context.nlp_analysis.entitie... | 2.515625 | 3 |
baselines/profiling/profile_main.py | Worm4047/TVR | 106 | 25327 | """
Profile the time needed for retrieval.
We consider retrieval in a corpus of 1M videos, 1K videos are added, 10K queries are retrieved.
Calculate the time needed for adding 1K videos, and performing retrieval for 10K queries.
1, Data Loading time is ignored, consider it is hidden by computation time.
2, Sort time i... | 2.84375 | 3 |
python/eskapade/tutorials/esk501_fix_pandas_dataframe.py | mbaak/Eskapade | 16 | 25328 | """Project: Eskapade - A python-based package for data analysis.
Macro: esk501_fix_pandas_dataframe
Created: 2017/04/26
Description:
Macro illustrates how to call FixPandasDataFrame link that gives columns
consistent names and datatypes.
Default settings perform the following clean-up steps on an
inp... | 2.796875 | 3 |
microdf/inequality.py | Peter-Metz/microdf | 0 | 25329 | import numpy as np
import microdf as mdf
def gini(df, col, w=None, negatives=None):
"""Calculates Gini index.
:param df: DataFrame.
:param col: Name of column in df representing value.
:param w: Column representing weight in df.
:param negatives: An optional string indicating how to treat negati... | 3.4375 | 3 |
web/adoption_stories/adopteeStories/models.py | CuriousG102/Chinese-Adoption | 0 | 25330 | from django.db import models
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from embed_video.fields import EmbedYoutubeField, EmbedSoundcloudField
from .custom_model_fields import RestrictedImageField
from .default_settings import ADOPTEE_STORIES_CONFIG as config
... | 2.078125 | 2 |
core/utils/gpu_check.py | andregri/keras-segmentation | 0 | 25331 | import tensorflow as tf
def check_gpu():
n_gpus = len(tf.config.experimental.list_physical_devices('GPU'))
print("Num GPUs Available: ", n_gpus)
check_gpu()
| 2.65625 | 3 |
pinakes/common/auth/keycloak_django/tests/test_permission_checks.py | Alex-Izquierdo/pinakes | 2 | 25332 | <gh_stars>1-10
from unittest import mock
from pinakes.common.auth.keycloak.models import (
AuthzPermission,
AuthzResource,
)
from pinakes.common.auth.keycloak_django.permissions import (
check_wildcard_permission,
check_resource_permission,
check_object_permission,
get_permitted_resources,
)
... | 2.375 | 2 |
apps/misc/context_processors.py | Thom03/edms-django | 70 | 25333 | from django.utils.translation import get_language
def django_settings(request):
return {
"LANGUAGE": get_language(),
}
| 1.65625 | 2 |
server.py | Arztpraxis/uno-server | 0 | 25334 | <reponame>Arztpraxis/uno-server
from json import JSONEncoder
from random import choice, sample
from threading import Thread, Timer, Lock
from types import SimpleNamespace
from os import execv
from sys import argv, executable
from optparse import OptionParser
from shlex import split
# Networking
from wsgiref.simple_ser... | 2.234375 | 2 |
interface/seed.py | matthewruttley/Bucketerer | 0 | 25335 | <reponame>matthewruttley/Bucketerer
#!/usr/bin/env python
#Creates an ad bucket with a seed term/domain
from pymongo import MongoClient
from similarity import find_by_html, find_by_similarsites, create_connection, tokenize_clean
from tabulate import tabulate
verbose = False
def get_rank(c, domain):
"""Gets the alex... | 2.8125 | 3 |
functional_tests/tests.py | BFH-E1D-2015-2016/iotdemo | 0 | 25336 | <gh_stars>0
from django.test import LiveServerTestCase
from selenium import webdriver
def populate_db():
from lorawan.tests import populate_db_with_devices
populate_db_with_devices(["Devices 1", "Devices 2"])
class NewVisitorTest(LiveServerTestCase):
def setUp(self):
import os
is_trav... | 2.5 | 2 |
imagepy/menus/Plugins/Manager/console_wgt.py | cycleuser/imagepy | 1 | 25337 | # -*- coding: utf-8 -*-
import wx
from wx.py.shell import Shell
import scipy.ndimage as ndimg
import numpy as np
# from imagepy import IPy
from imagepy.core.engine import Free
from sciapp import Source
cmds = {'app':'app', 'np':np, 'ndimg':ndimg, 'update':None, 'get_img':None}
class Macros(dict):
def __init__(se... | 2.078125 | 2 |
Support/Fuego/Pythia/pythia-0.5/packages/pyre/pyre/applications/Application.py | balos1/PelePhysics | 31 | 25338 | <filename>Support/Fuego/Pythia/pythia-0.5/packages/pyre/pyre/applications/Application.py
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 19... | 2.203125 | 2 |
cars/models.py | zhangpotato/kx_backmanage | 0 | 25339 | from django.db import models
# Create your models here.
class Car_basic(models.Model):
car_number = models.CharField(max_length=10, null=True, blank=True)
car_color = models.CharField(max_length=10, null=True, blank=True)
register_date = models.DateTimeField(null=True, blank=True)
user_name = models.C... | 2.25 | 2 |
pytorch_binding/setup.py | rickyHong/Warp-ctc-repl | 0 | 25340 | # build.py
import os
import platform
import sys
from distutils.core import setup
from torch.utils.ffi import create_extension
extra_compile_args = ['-std=c++11', '-fPIC']
warp_ctc_path = "../build"
if platform.system() == 'Darwin':
lib_ext = ".dylib"
else:
lib_ext = ".so"
if "WARP_CTC_PATH" in os.environ:
... | 1.929688 | 2 |
ddganAE/utils.py | Zeff020/Adversarial_ROM | 1 | 25341 | <filename>ddganAE/utils.py
"""
General utilities for package
"""
import numpy as np
import keras.backend as K
from keras.losses import mse
__author__ = "<NAME>"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
def calc_po... | 2.125 | 2 |
Preprocess/mosaic_utils.py | monchhichizzq/CenterNet | 0 | 25342 | <filename>Preprocess/mosaic_utils.py
# -*- coding: utf-8 -*-
# @Time : 2020/12/28 23:33
# @Author : Zeqi@@
# @FileName: mosaic_utils.py
# @Software: PyCharm
import os
import cv2
from PIL import Image
import numpy as np
def merge_bboxes(bboxes, cutx, cuty):
merge_bbox = []
for i in range(len(bboxes)):
... | 2.390625 | 2 |
starter_code/api_keys.py | tstenner1/python-api-challenge | 0 | 25343 | # OpenWeatherMap API Key
weather_api_key = "<KEY>"
# Google API Key
g_key = "<KEY>"
| 1.21875 | 1 |
zoopla_history.py | chaudhary-amit/zoopla-scraper | 1 | 25344 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 26 16:48:20 2017
@author: AC
"""
import logging
from lxml import html
import requests
import zoopla_rq
logger = logging.getLogger()
class HomeListing():
def __init__(self, config, parent_id, history_id, survey_id):
self.config = config
self.par... | 2.640625 | 3 |
cavoke_server/tasks.py | cavoke-project/cavoke_server | 0 | 25345 | # from celery.schedules import crontab
# from celery.task import periodic_task
# from django.utils import timezone
# from cavoke_app.models import GameSession
#
#
# @periodic_task(run_every=crontab(minute='*/1'))
# def delete_old_foos():
# # Query all the foos in our database
# gss = GameSession.objects.all()
#... | 2.3125 | 2 |
src/stock/lib/daily.py | callim105/alphascan | 1 | 25346 | <gh_stars>1-10
import requests
import pandas as pd
from util.api_util import AV_API_KEY
def daily_adjusted_ohlc(symbol):
url = f"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol={symbol}&outputsize=full&apikey={AV_API_KEY}"
r = requests.get(url)
data = r.json()
df = pd.DataF... | 2.921875 | 3 |
FindingUsefulPoints/CodeThatClassifiesPoints.py | PaoloMura/VoronoiAR | 0 | 25347 | from Point import *
'''
A function that compares the distance of all the other points to a cast point
with the distance from that cast point to the point it was casted from and
returns either a closer point than the original one or the cast if the original
was already the closest one
'''
def Searching(_cast, _distance... | 3.921875 | 4 |
label_studio/ml/examples/object_detection.py | zoumt1633/label-studio | 0 | 25348 | <filename>label_studio/ml/examples/object_detection.py<gh_stars>0
# -*- coding: utf-8 -*-
# @Time : 2020/7/12 14:19
# @Author : zoumaotai
# @Email : <EMAIL>
# @File : object_detection.py
# @Software: PyCharm
import random
import urllib
from gluoncv import model_zoo, data
from label_studio.ml import LabelStudi... | 2.296875 | 2 |
ee/cli/plugins/sync.py | quimica/easyengine | 0 | 25349 | from cement.core.controller import CementBaseController, expose
from cement.core import handler, hook
from ee.core.fileutils import EEFileUtils
from ee.cli.plugins.sitedb import *
from ee.core.mysql import *
from ee.core.logging import Log
def ee_sync_hook(app):
# do something with the ``app`` object here.
pa... | 2.03125 | 2 |
nempy/spot_markert_backend/variable_ids.py | hy3440/nempy | 24 | 25350 | <reponame>hy3440/nempy
import pandas as pd
import numpy as np
from nempy.help_functions import helper_functions as hf
def bids(volume_bids, unit_info, next_variable_id):
"""Create decision variables that correspond to unit bids, for use in the linear program.
This function defines the needed parameters for e... | 3.390625 | 3 |
numba/cuda/tests/cudapy/test_random.py | blair1306/numba | 76 | 25351 | import math
import numpy as np
from numba import cuda, float32
from numba.cuda.testing import unittest
import numba.cuda.random
from numba.cuda.testing import skip_on_cudasim, CUDATestCase
from numba.cuda.random import \
xoroshiro128p_uniform_float32, xoroshiro128p_normal_float32, \
xoroshiro128p_uniform_flo... | 2.328125 | 2 |
reviewboard/scmtools/sshutils.py | smorley/reviewboard | 1 | 25352 | <filename>reviewboard/scmtools/sshutils.py
import os
import urlparse
from django.utils.translation import ugettext_lazy as _
import paramiko
from reviewboard.scmtools.errors import AuthenticationError, \
BadHostKeyError, SCMError, \
Unkno... | 2.375 | 2 |
extract_data.py | dsrincon/bitcoin_network_analysis | 0 | 25353 | # -*- coding: utf-8 -*-
# Functions and Script to extract data
import blocksci
import pandas as pd
import numpy as np
import networkx as nx
import multiprocessing as mp
import itertools
import random
import time
import string
import pickle
import csv
import gc
import os, sys
from functools import partial
#********... | 2.796875 | 3 |
egs/wmt14_en_de/nlp1/local/generate_stand_vocab.py | didichuxing/delta | 1,442 | 25354 | # Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# 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/LI... | 2.375 | 2 |
Preprocessing/Crawler/Crawler.py | sambacha/pyblock | 0 | 25355 | <reponame>sambacha/pyblock<gh_stars>0
"""A client to interact with node and to save data to mongo."""
from pymongo import MongoClient
import crawler_util
import requests
import json
import sys
import os
import logging
import time
import tqdm
sys.path.append(os.path.realpath(os.path.dirname(__file__)))
DIR = "/mnt/c/... | 2.671875 | 3 |
packages/models-library/src/models_library/__init__.py | elisabettai/osparc-simcore | 0 | 25356 | <filename>packages/models-library/src/models_library/__init__.py
""" osparc's service models library
"""
#
# NOTE:
# - "examples" = [ ...] keyword and NOT "example". See https://json-schema.org/understanding-json-schema/reference/generic.html#annotations
#
import pkg_resources
__version__: str = pkg_resources.get_... | 1.328125 | 1 |
chords/more/gevent_task.py | omergertel/chords | 0 | 25357 | import functools
from gevent import spawn
from ..task import Task
class GeventTask(Task):
"""
Task that spawns a greenlet
"""
def start(self, *args, **kwargs):
return spawn(functools.partial(Task.start, self, *args, **kwargs))
| 2.46875 | 2 |
tst/drivers/uart/uart_suite.py | ivankravets/pumbaa | 69 | 25358 | <reponame>ivankravets/pumbaa
#
# @section License
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2017, <NAME>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, includ... | 2.4375 | 2 |
elasticapm/instrumentation/packages/tornado_httplib_response.py | laerteallan/apm-agent-python | 2 | 25359 | from elasticapm.instrumentation.packages.base import AbstractInstrumentedModule
from elasticapm.traces import capture_span
from elasticapm.utils import default_ports
from elasticapm.utils.compat import urlparse
def get_host_from_url(url):
parsed_url = urlparse.urlparse(url)
host = parsed_url.hostname or " "
... | 2.109375 | 2 |
src/waldur_ansible/python_management/migrations/0004_removed_virtual_env_field_from_global_requests.py | opennode/waldur-ansible | 1 | 25360 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-27 14:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('python_management', '0003_added_unique_constraint'),
]
operations = [
migrations.Re... | 1.515625 | 2 |
pymain.py | Farhad-Mrkm/NCE_ICC-2022 | 1 | 25361 | # author__Farhad_Mirkarimi-*- coding: utf-8 -*-
import os
import h5py
import glob, os
import numpy as np
import matplotlib.pyplot as plt
from numpy import mean
from numpy import std
import torch
import torch.nn as nn
from tqdm.auto import tqdm, trange
from numpy.random import default_rng
import torch.nn.functional as F... | 2 | 2 |
libpySat/pySatTransformPolarMotion.py | grzeskokbol/pySatTools | 0 | 25362 |
import datetime
import numpy as np
import libpySat as pySat
from astropy import _erfa as erfa
from scipy.misc import derivative
from scipy import interpolate
class TransformPolarMotion:
def __init__(self,fxp,fyp):
self.fxp=fxp
self.fyp=fyp
self.epochSave = datetime.datetime.now()
... | 2.578125 | 3 |
graphtheory/dominatingsets/tests/test_dsetus.py | mashal02/graphs-dict | 36 | 25363 | <filename>graphtheory/dominatingsets/tests/test_dsetus.py
#!/usr/bin/python
import unittest
from graphtheory.structures.edges import Edge
from graphtheory.structures.graphs import Graph
from graphtheory.dominatingsets.dsetus import UnorderedSequentialDominatingSet
# 0 --- 1 --- 2 not bipartite (triangles are present)... | 3.03125 | 3 |
wet_chicken_discrete/baseline_policy.py | Philipp238/Safe-Policy-Improvement-Approaches-on-Discrete-Markov-Decision-Processes | 0 | 25364 | import numpy as np
import pandas as pd
class WetChickenBaselinePolicy:
def __init__(self, env, gamma, method='heuristic', epsilon=0.1, convergence=0.1, learning_rate=0.1, max_nb_it=999,
order_epsilon=3, order_learning_rate=3):
self.env = env
self.gamma = gamma
self.nb_stat... | 2.15625 | 2 |
timeflow/__init__.py | zach-nervana/TimeFlow | 76 | 25365 | <filename>timeflow/__init__.py
import layers as layers
import placeholders as placeholders
import trainer as trainer
import features as features
import utils as utils
| 1.1875 | 1 |
plot_graphs.py | bsciolla/merks | 1 | 25366 |
import matplotlib.pyplot as plt
import networkx as nx
import numpy
plt.ion()
# test
def plot_neural_network(mek):
G = nx.DiGraph(numpy.transpose(mek.nn.links))
mylabels = dict(zip(range(len(mek.nn.neurons)),
[to_string(i)+'\n#'
+ str(ix)+'' for (ix, i) in enum... | 2.84375 | 3 |
Logistic-Regression/code.py | VaidikTrivedi/ga-learner-dsb-repo | 0 | 25367 | <reponame>VaidikTrivedi/ga-learner-dsb-repo<gh_stars>0
# --------------
import pandas as pd
from sklearn.model_selection import train_test_split
df = pd.read_csv(path)
print(df.head(5))
X = df.drop('insuranceclaim', axis=1)
#print(X.head(5))
y = df['insuranceclaim']
X_train, X_test, y_train, y_test = train_tes... | 2.578125 | 3 |
tests/test_sink.py | LauWien/smooth | 5 | 25368 | <filename>tests/test_sink.py<gh_stars>1-10
from smooth.components.component_sink import Sink
import oemof.solph as solph
def test_init():
s = Sink({})
assert hasattr(s, "input_max")
assert hasattr(s, "bus_in")
assert s.commodity_costs == 0
s = Sink({"name": "foo"})
assert s.name == "foo"
de... | 2.3125 | 2 |
Forex/KalmanFilterPairsTrading.py | pvkraju80/Financial-Algorithms | 6 | 25369 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 8 17:50:11 2019
@author: ArmelFabrice
"""
##### import the necessary modules and set chart style####
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.style.use('bmh')
import matplotlib.pylab as plt
import statsmodels.api as sm
from math... | 2.125 | 2 |
gym/tests/webserver.py | intrig-unicamp/gym | 8 | 25370 | import sys
import json
import asyncio
import aiohttp
from aiohttp import web
from urllib.parse import urlparse
class SimpleWebServer:
def __init__(self):
self.loop = asyncio.get_event_loop()
self.app = web.Application(loop=self.loop)
async def check_ack(self):
asyncio.sleep(1)
... | 2.765625 | 3 |
fundamentos/exer027.py | edelvandro/Python | 1 | 25371 | '''
Faça um programa que leia o nome completo de uma pessoa,
mostrando em seguida o primeiro e o último nome separadamente.
'''
entrada = str(input('Digite um nome completo: ')).strip()
print('Olá {}'.format(entrada))
nome = entrada.split()
print('Seu primeiro nome é: {}'.format(nome[0]))
print('Seu último nom... | 3.953125 | 4 |
convert_to_neglog.py | yashkhem1/chemprop | 0 | 25372 | import csv
import numpy as np
import os
infile = "dopamine_processed.csv"
outfile = "dopamine.csv"
if os.path.exists(outfile):
os.remove(outfile)
with open(infile, 'r', newline='') as f:
i=0
reader = csv.reader(f,delimiter=',')
for row in reader:
with open(outfile, 'a', newline='') as w:
... | 2.59375 | 3 |
DummyIntermediateDevices/connectiontable_dummy_intermediate.py | fretchen/synqs_devices | 0 | 25373 | """The sample file to be run in runmanager.
This is the minimal sample that you can load from runmanager to see if your
code is working properly.
"""
from labscript import *
# from user_devices.dummy_device.labscript_devices import DummyDevice
from labscript_devices.DummyPseudoclock.labscript_devices import DummyPse... | 2.28125 | 2 |
src/autoencoder/dataset.py | fabiobedeschi/datepalm | 0 | 25374 | <reponame>fabiobedeschi/datepalm<filename>src/autoencoder/dataset.py<gh_stars>0
from keras_preprocessing.image import ImageDataGenerator
from src.config import IMG_SIZE
from src.autoencoder.params import BATCH_SIZE
def load_train_dataset(train_dir: str, batch_size=BATCH_SIZE, img_size=IMG_SIZE, val_split=0.2):
t... | 2.546875 | 3 |
test/knxip_tests/hpai_test.py | iligiddi/xknx | 179 | 25375 | <filename>test/knxip_tests/hpai_test.py<gh_stars>100-1000
"""Unit test for KNX/IP HPAI objects."""
import pytest
from xknx.exceptions import ConversionError, CouldNotParseKNXIP
from xknx.knxip import HPAI
class TestKNXIPHPAI:
"""Test class for KNX/IP HPAI objects."""
def test_hpai(self):
"""Test pars... | 2.640625 | 3 |
cloudmesh/sign/api.py | cloudmesh/cloudmesh.sign | 0 | 25376 | <filename>cloudmesh/sign/api.py
from __future__ import print_function
#import cv2
class Sign(object):
def __init__(self):
# not your location will not work easily / is not writeable
self.classifier = '/street-signal/classifier/stopsign_classifier.xml'
def hello(self, msg):
pri... | 2.609375 | 3 |
profrage/generate/utils.py | federicoVS/ProFraGe | 0 | 25377 | import torch
def reparametrize(mu, log_var, device):
"""
Reparametrize based on input mean and log variance
Parameters
----------
mu : torch.tensor
The mean.
log_var : torch.tensor
The log variance.
device : str
The device on which to put the data.
Returns
... | 3.0625 | 3 |
neighbor_app/views.py | LawiOtieno/neighborhood-alert | 0 | 25378 | from django.shortcuts import render,redirect,get_object_or_404,HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth import login, authenticate
from .forms import *
from .models import NeighborHood,Profile,Post,Business
from django.contrib.sites.shortcuts import get_cu... | 2.015625 | 2 |
declare_qtquick/application.py | likianta/declare-qtquick | 3 | 25379 | <filename>declare_qtquick/application.py
import os.path as xpath
from PySide6.QtCore import QObject
from PySide6.QtQml import QQmlApplicationEngine
from PySide6.QtQml import QQmlContext
from PySide6.QtWidgets import QApplication
from .typehint import Dict
from .typehint import TPath
class _Application(QApplication)... | 1.945313 | 2 |
src/main.py | mdsanima-dev/mdsanima-rt-go | 2 | 25380 | <gh_stars>1-10
"""
Main application MDSANIMA RT GO
"""
import kivy
from __init__ import __version__
kivy.require('2.0.0')
from kivy.uix.screenmanager import ScreenManager
from kivymd.app import MDApp
from plyer import notification
from __init__ import resource_path
from config.image import get_images
from config.... | 2.25 | 2 |
puzzler/puzzles/polysticks123.py | tiwo/puzzler | 0 | 25381 | #!/usr/bin/env python
# $Id$
# Author: <NAME> <<EMAIL>>
# Copyright: (C) 1998-2015 by <NAME>
# License: GPL 2 (see __init__.py)
"""
Concrete polystick (orders 1 through 3) puzzles.
"""
from puzzler import coordsys
from puzzler.puzzles.polysticks import Polysticks123
class Polysticks123_4x4ClippedCorners1(Polystick... | 3.09375 | 3 |
src/scoring/split_by_target.py | annacarbery/VS_ECFP | 0 | 25382 | <gh_stars>0
from sklearn import tree
import os
import random
import numpy as np
import json
DATA_DIR = '/Users/tyt15771/Documents/VS_ECFP/data/input/'
data_train = []
class_train = []
data_test = []
class_test = []
hits = os.listdir(f'{DATA_DIR}/hit')
random.shuffle(hits)
miss = os.listdir(f'{DATA_DIR}/miss')
rand... | 2.0625 | 2 |
AsRoot/app/views.py | erin-hughes/qradar-sample-apps | 8 | 25383 | <reponame>erin-hughes/qradar-sample-apps
# Copyright 2020 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 1.859375 | 2 |
web/code/mmg/jobtrak/util/__init__.py | 559Labs/JobTrak | 1 | 25384 | default_app_config = 'mmg.jobtrak.util.apps.LocalConfig' | 1.0625 | 1 |
timemachines/skaters/nproph/nprophetiskaterfactory.py | iklasky/timemachines | 253 | 25385 | <filename>timemachines/skaters/nproph/nprophetiskaterfactory.py
from timemachines.skaters.nproph.nprophetinclusion import using_neuralprophet, NeuralProphet
if using_neuralprophet:
import pandas as pd
from typing import List, Tuple, Any
from timemachines.skatertools.utilities.conventions import wrap
fro... | 1.992188 | 2 |
cride/teachers/serializers/skills.py | alexhernandez-git/cride-frontend | 0 | 25386 | <reponame>alexhernandez-git/cride-frontend<filename>cride/teachers/serializers/skills.py
"""Teacher serializer."""
# Django REST Framework
from rest_framework import serializers
# Models
from cride.teachers.models import Skill
class SkillModelSerializer(serializers.ModelSerializer):
"""Profile model serializer.... | 2.59375 | 3 |
ibt/context.py | rcook/ibt | 0 | 25387 | ###############################################################################
#
# IBT: Isolated Build Tool
# Copyright (C) 2016, <NAME>. All rights reserved.
#
# Simple wrappers around Docker etc. for fully isolated build environments
#
###############################################################################
... | 1.96875 | 2 |
holobot/sdk/exceptions/argument_error.py | rexor12/holobot | 1 | 25388 | <gh_stars>1-10
class ArgumentError(Exception):
def __init__(self, argument_name: str, *args) -> None:
super().__init__(*args)
self.argument_name = argument_name
@property
def argument_name(self) -> str:
return self.__argument_name
@argument_name.setter
def argument_name... | 3 | 3 |
python/cogs/helpall.py | HexF/felix | 0 | 25389 | """This is a cog for a discord.py bot.
It hides the help command and adds these commands:
helpall show all commands (including all hidden ones)
The commands will output to the current channel or to a dm channel
according to the pm_help kwarg of the bot.
Only users that have an admin role can use the ... | 2.890625 | 3 |
helpers.py | SacaSoh/AIPND---Project-2 | 0 | 25390 | <reponame>SacaSoh/AIPND---Project-2<filename>helpers.py
# PROGRAMMER: <NAME>
# DATE CREATED: Mar, 23, 2019.
# REVISED DATE:
# PURPOSE: Helpers for training a CNN and to predict the class for an input image
import argparse
import numpy as np
import torch
import json
from torch import nn
from torch import optim
from ... | 2.625 | 3 |
test_single.py | hkchengrex/CharTrans-GAN | 2 | 25391 | <reponame>hkchengrex/CharTrans-GAN
from net import Net
from font_loader import FontDataset
import torch
import torchvision
import torchvision.transforms as transforms
font_root = './data/test1/'
std_font = './data/standard/'
font_size = 52
image_size = 48
numTransform = 5
numRef = 5
char_list_path = './character_se... | 2.25 | 2 |
tests/package_path_test.py | radiasoft/sirepo | 49 | 25392 | <gh_stars>10-100
# -*- coding: utf-8 -*-
u"""Using a sim type that lives in a package outside of sirepo.
:copyright: Copyright (c) 2021 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import contextlib
i... | 1.875 | 2 |
fanficdownloader/story.py | rodrigonz/rodrigodeoliveiracosta-ffdown | 0 | 25393 | # -*- coding: utf-8 -*-
# Copyright 2011 Fanficdownloader 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 require... | 2.09375 | 2 |
2021/07/2021-07-2 The Treachery of Whales.py | dpustovarov/Advent-of-Code | 0 | 25394 | import sys, statistics
def solution(N):
m = int(round(statistics.mean(N))) # average for (n - i)**2
d = int(statistics.median(N)) # average for abs(n - i)
return min(sum((n - i)**2 + abs(n - i) for n in N) for i in range(m, d, (d > m) - (d < m))) // 2
print(solution([int(n) for n in sys.stdin.read(... | 3.09375 | 3 |
app/__init__.py | PushyZqin/flask-restful-plugin | 2 | 25395 | <filename>app/__init__.py<gh_stars>1-10
#encoding:utf-8
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import config
app = Flask(__name__)
app.config.from_object(config)
db = SQLAlchemy(app)
from app import req_demo, res_demo, models | 1.679688 | 2 |
scripts/storage.py | ibigbug/mixin-bot | 0 | 25396 | <reponame>ibigbug/mixin-bot<gh_stars>0
import os
import sys
from azure.storage.blob import BlockBlobService
from azure.common import AzureMissingResourceHttpError
account_name = os.environ.get('azure_storage_account_name')
account_key = os.environ.get('azure_storage_account_key')
container_name = os.environ.get('azur... | 2.28125 | 2 |
t5/models/hf_model.py | thomasw21/text-to-text-transfer-transformer | 1 | 25397 | # Copyright 2021 The T5 Authors.
#
# 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.265625 | 2 |
api-reference-examples/python/pytx/pytx/threat_descriptor.py | b-bold/ThreatExchange | 997 | 25398 | <filename>api-reference-examples/python/pytx/pytx/threat_descriptor.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .common import Common
from .vocabulary import ThreatDescriptor as td
from .vocabulary import ThreatExchange as t
class ThreatDescriptor(Common):
_URL = t.URL + t.VERS... | 1.898438 | 2 |
why_how_what/multiarmed_bandit.py | chandrabsingh/learnings | 0 | 25399 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
class BanditClass:
def __init__(self, epsilon, leverCount, probs):
self.epsilon = epsilon
self.leverCount = leverCount
self.probs = probs
self.redefineSettings()
def calcAction(self):
#... | 2.71875 | 3 |