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 |
|---|---|---|---|---|---|---|
search.py | joyfulflyer/billboard-spotify | 0 | 34300 | from spotify_auth import auth
from urllib import parse
import json
def search(track_name, artist, type='track'):
parsed = parse.quote_plus(query)
query = "artist:{}%20track:{}".format(artist, track_name)
response = auth.get(
'https://api.spotify.com/v1/search?q={}&type={}'.format(query, type))
... | 2.921875 | 3 |
fastccd_support_ioc/fastccd_support_ioc.py | lbl-camera/fastccd_support_ioc | 0 | 34301 | <reponame>lbl-camera/fastccd_support_ioc<filename>fastccd_support_ioc/fastccd_support_ioc.py<gh_stars>0
from caproto.server import PVGroup, SubGroup, pvproperty, get_pv_pair_wrapper
from caproto import ChannelType
from . import utils, pvproperty_with_rbv, wrap_autosave, FastAutosaveHelper
from textwrap import dedent
i... | 2.21875 | 2 |
infrastructure-dashboard/nccid-redirect/lambda/lambda-handler.py | uk-gov-mirror/NHSX.covid-chest-imaging-database | 56 | 34302 | def handler(event, context):
return {
"statusCode": 302,
"headers": {
"Location": "https://www.nhsx.nhs.uk/covid-19-response/data-and-covid-19/national-covid-19-chest-imaging-database-nccid/"
},
}
| 1.609375 | 2 |
MachineLearning/SparkPREDICT_E2E_MLFLOW_Xgboost.py | AjAgr/Synapse | 0 | 34303 | #!/usr/bin/env python
# coding: utf-8
# ## E2E Xgboost MLFLOW
# In[45]:
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, pandas_udf,udf,lit
import azure.synapse.ml.predict as pcontext
import azure.synapse.ml.predict.utils._logger as synapse_predict_logger
import numpy as np
import panda... | 2.328125 | 2 |
models/gaze_rnn77.py | yj-yu/Recurrent_Gaze_Prediction | 9 | 34304 | <reponame>yj-yu/Recurrent_Gaze_Prediction
#-*- coding: utf-8 -*-
"""
gaze_rnn7.py
Implement a simple recurrent gaze prediction model based on RNN(GRU).
In this version, the gaze DIM is REDUCED to 7x7 dimension.
"""
# TODO separate pupil from gazemaps, AWFUL design
import numpy as np
import os
import sys
import time... | 2.3125 | 2 |
py/dcp/problems/graph/max_edges.py | bmoretz/Daily-Coding-Problem | 1 | 34305 | from collections import defaultdict
from .common import IGraph
''' Remove edges to create even trees.
You are given a tree with an even number of nodes. Consider each connection between a parent and child node to be an "edge". You
would like to remove some of these edges, such that the disconnected subtrees that rem... | 4.09375 | 4 |
test_pytrain/test_KNN/test_KNN.py | pytrain/pytrain-shallow | 20 | 34306 | <reponame>pytrain/pytrain-shallow<gh_stars>10-100
#
# test KNN
#
# @ author becxer
# @ email <EMAIL>
#
from test_pytrain import test_Suite
from pytrain.KNN import KNN
from pytrain.lib import autotest
from pytrain.lib import dataset
import numpy as np
class test_KNN_iris(test_Suite):
def __init__(self, logging = T... | 2.875 | 3 |
python_data_utils/spark/ml/randomforest.py | surajiyer/python-data-utils | 4 | 34307 | <reponame>surajiyer/python-data-utils<gh_stars>1-10
__all__ = ['RandomForestBinaryModel']
from pyspark.sql import DataFrame
from pyspark.ml.classification import RandomForestClassifier
from python_data_utils.spark.evaluation.multiclass import MulticlassEvaluator
from python_data_utils.spark.ml.base import BinaryClass... | 2.78125 | 3 |
predict.py | zahrabashir98/SmileDetection | 17 | 34308 | import sys
import cv2
from keras.models import load_model
from matplotlib import pyplot as plt
import time
model = load_model("models/model.h5")
def find_faces(image):
face_cascade = cv2.CascadeClassifier('data/haarcascade_frontalface_default.xml')
face_rects = face_cascade.detectMultiScale(
image,... | 2.875 | 3 |
src/brute_force.py | tcysin/tsp-solver | 2 | 34309 | """
Implementation of Brute Force algorithm.
Checks all possible tours and selects the shortest one.
"""
from itertools import permutations
def brute_force(graph):
"""Calculates and returns shortest tour using brute force approach.
Runs in O(n!). Provides exact solution.
Args:
graph: instance ... | 4.0625 | 4 |
web_app.py | akshitagupta23/Udacity_DS_ND_Capstone_Project | 0 | 34310 | <reponame>akshitagupta23/Udacity_DS_ND_Capstone_Project
#! /usr/bin/env python3
# coding=utf-8
import streamlit as st
import numpy as np
import pandas as pd
import joblib
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.compose import Col... | 2.921875 | 3 |
evaluation.py | Sockeye-Project/decl-power-seq | 0 | 34311 | <reponame>Sockeye-Project/decl-power-seq<filename>evaluation.py
#! /usr/bin/env python3
import argparse
import random
import timeit
import copy
from sequence_generation import State_Search_Flags, Topology, topological_sort
from enzian_descriptions import enzian_nodes, enzian_wires, enzian_nodes_EVAL3
problems = [
... | 1.96875 | 2 |
venv/Lib/site-packages/gensim/test/test_probability_estimation.py | arnoyu-hub/COMP0016miemie | 0 | 34312 | <filename>venv/Lib/site-packages/gensim/test/test_probability_estimation.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 <NAME> <<EMAIL>>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for probability estimation algorithms in the probabilit... | 2.46875 | 2 |
src/geomm/centering.py | stxinsite/geomm | 3 | 34313 | <reponame>stxinsite/geomm
import numpy as np
from geomm.centroid import centroid
def center(coords, center_point):
"""Center coordinates at the origin based on a center point.
If idxs are given the center of mass is computed only from those
coordinates and if weights are given a weighted center of mass i... | 3.8125 | 4 |
xigt/exporters/itsdb.py | lizcconrad/xigt | 0 | 34314 | import logging
from os.path import isfile, join as pjoin
from os import environ
try:
from delphin import tsdb
except ImportError:
raise ImportError(
'Could not import pyDelphin module. Get it from here:\n'
' https://github.com/goodmami/pydelphin'
)
# ECC 2021-07-26: the lambda for i-comm... | 1.984375 | 2 |
spectrum_test.py | PeiKaLunCi/rectangular_RIE | 2 | 34315 | import numpy as np
import matplotlib.pyplot as plt
import g_functions as g_f
R1 = 2
R2 = .6
M = 500
Delta = .1
NB_POINTS = 2**10
EPSILON_IMAG = 1e-8
parameters = {
'M' : M,
'R1' : R1,
'R2' : R2,
'NB_POINTS' : NB_POINTS,
'EPSILON_IMAG' : EPSILON_IMAG,
've... | 2.625 | 3 |
Part_2_intermediate/mod_2/lesson_2/homework_1/homework.py | Mikma03/InfoShareacademy_Python_Courses | 0 | 34316 | <filename>Part_2_intermediate/mod_2/lesson_2/homework_1/homework.py<gh_stars>0
# Utwórz klasy do reprezentacji Produktu, Zamówienia, Jabłek i Ziemniaków.
# Stwórz po kilka obiektów typu jabłko i ziemniak i wypisz ich typ za pomocą funkcji wbudowanej type.
# Stwórz listę zawierającą 5 zamówień oraz słownik, w którym kl... | 4.40625 | 4 |
examples/validate_ndc.py | almarklein/visvis2 | 7 | 34317 | <gh_stars>1-10
"""
Example (and test) for the NDC coordinates. Draws a square that falls partly out of visible range.
* The scene should show a band from the bottom left to the upper right.
* The bottom-left (NDC -1 -1) must be green, the upper-right (NDC 1 1) blue.
* The other corners must be black, cut off at exactl... | 2.453125 | 2 |
myy/accounts/admin.py | ramadevim/Travel-website | 0 | 34318 | from django.contrib import admin
# Register your models here.
from .models import Register
admin.site.register(Register) | 1.289063 | 1 |
ipy/nuisancelib.py | chrispycheng/nuisance | 0 | 34319 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import statsmodels.api as sm
import datetime as dt
from statsmodels.stats.multitest import fdrcorrection
from pylab import savefig
# FUNCTIONS YOU CAN USE:
# analyses(filepath) spits out a nifty heatmap to let you check ... | 2.4375 | 2 |
tests/test_config_defaults.py | nmichlo/eunomia | 3 | 34320 | import pytest
from eunomia.config._default import Default
from eunomia.config.nodes import ConfigNode
from tests.test_backend_obj import _make_config_group
# ========================================================================= #
# Test YAML & Custom Tags #
# ===... | 2.0625 | 2 |
rj_gameplay/stp/coordinator.py | RoboJackets/robocup-software | 200 | 34321 | <gh_stars>100-1000
"""This module contains the implementation of the coordinator."""
from typing import Any, Dict, Optional, Type, List, Callable
import stp.play
import stp.rc as rc
import stp.role.assignment as assignment
import stp.situation
import stp.skill
from rj_msgs import msg
NUM_ROBOTS = 16
class Coordinat... | 2.5625 | 3 |
apf/core/templates/step/package/step.py | alercebroker/APF | 2 | 34322 | <reponame>alercebroker/APF
from apf.core.step import GenericStep
import logging
class {{step_name}}(GenericStep):
"""{{step_name}} Description
Parameters
----------
consumer : GenericConsumer
Description of parameter `consumer`.
**step_args : type
Other args passed to step (DB con... | 2.28125 | 2 |
Linux/.local/share/ulauncher/extensions/com.github.ulauncher.ulauncher-kill/main.py | altdx/dotfiles | 0 | 34323 | import os
import logging
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Notify', '0.7')
from locale import atof, setlocale, LC_NUMERIC
from gi.repository import Notify
from itertools import islice
from subprocess import check_output, check_call, CalledProcessError
from ulauncher.api.client.Extension i... | 1.96875 | 2 |
toutiao-backend/toutiao/resources/user/profile.py | weiyunfei520/toutiao | 0 | 34324 | from flask import current_app
from flask import g
from flask import request
from flask_restful.reqparse import RequestParser
from flask_restful import Resource
from models import db
from models.user import User
from utils.decorators import login_required
from utils.parser import image_file
from utils.storage import up... | 2.375 | 2 |
manim/utils/unit.py | PhotonSpheres/manim | 9,497 | 34325 | """Implement the Unit class."""
import numpy as np
from .. import config, constants
__all__ = ["Pixels", "Degrees", "Munits", "Percent"]
class _PixelUnits:
def __mul__(self, val):
return val * config.frame_width / config.pixel_width
def __rmul__(self, val):
return val * config.frame_width ... | 3.140625 | 3 |
backend/auth_app/serializers/__init__.py | nitinmehra/TodoApp | 0 | 34326 | from .auth_serializer import MyTokenObtainPairSerializer
from .register_serializer import UserRegisterSerializer | 1.117188 | 1 |
src/sensors.py | andrew-chang-dewitt/rpi-pir2mqtt-docker | 1 | 34327 | """A module for defining Sensor types.
Classes:
Sensor -- Base Sensor class, all unknown types default to this.
MotionSensor -- Subclass of Sensor, for HC-SR501 type PIR sensors.
ReedSwitch -- Subclass of Sensor, for basic door/window reed switches.
Functions:
build_sensor -- Build & return a ... | 3.390625 | 3 |
main.py | TwoShock/Graphics-Card-Web-Scraper | 0 | 34328 | from urllib.request import urlopen
from bs4 import BeautifulSoup as soup
import re
import pandas as pd
def getContainerInfo(container):
name = container.img['title']
itemInfo = container.find('div',class_='item-info')
itemBranding = itemInfo.find('div',class_ = 'item-branding')
brandName = itemBranding... | 2.875 | 3 |
python/qisrc/actions/checkout.py | aldebaran/qibuild | 51 | 34329 | <reponame>aldebaran/qibuild
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
"""
Change the branch of the manifest
Also, checkout the correct branch for every git project i... | 1.734375 | 2 |
experiments/calc_avg_bohb_time.py | automl/learning_environments | 11 | 34330 | import statistics
import hpbandster.core.result as hpres
# smallest value is best -> reverse_loss = True
# largest value is best -> reverse_loss = False
REVERSE_LOSS = True
EXP_LOSS = 1
OUTLIER_PERC_WORST = 0.1
OUTLIER_PERC_BEST = 0.0
def analyze_bohb(log_dir):
# load the example run from the log files
res... | 2.484375 | 2 |
radio/preprocessing/augmented_batch.py | dmitrysarov/radio-1 | 0 | 34331 | <reponame>dmitrysarov/radio-1
""" Contains CTImagesAugmentedBatch: masked ct-batch with some augmentation actions """
import numpy as np
from .ct_masked_batch import CTImagesMaskedBatch
from ..dataset.dataset import action, Sampler # pylint: disable=no-name-in-module
from .mask import insert_cropped
class CTImagesA... | 2.484375 | 2 |
tf2/ThickCylinder_DEM.py | ISM-Weimar/DeepEnergyMethods | 15 | 34332 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
2D linear elasticity example
Solve the equilibrium equation -\nabla \cdot \sigma(x) = f(x) for x\in\Omega
with the strain-displacement equation:
\epsilon = 1/2(\nabla u + \nabla u^T)
and the constitutive law:
\sigma = 2*\mu*\epsilon + \lambda*(\nabla\cdot u)I,... | 2.765625 | 3 |
src/trw/utils/clamp_n.py | civodlu/trw | 3 | 34333 | from typing import Sequence, Any
import torch
def clamp_n(tensor: torch.Tensor, min_values: Sequence[Any], max_values: Sequence[Any]) -> torch.Tensor:
"""
Clamp a tensor with axis dependent values.
Args:
tensor: a N-d torch.Tensor
min_values: a 1D torch.Tensor. Min value is axis dependent... | 2.96875 | 3 |
bin2dec.py | Alba3k/BinToDec | 0 | 34334 | def bin2dec(binNumber):
decNumber = 0
index = 1
binNumber = binNumber[::-1]
for i in binNumber:
number = int(i) * index
decNumber = decNumber + number
index = index * 2
return decNumber
print('ВВЕДИТЕ ДВОИЧНОЕ 8-БИТНОЕ ЧИСЛО')
binNumber = input('>')
if len(binNumber) != 8:
print('ВВЕДИТЕ ПРАВИЛЬНОЕ 8-БИТН... | 3.765625 | 4 |
taskmanager/src/modules/tasks/domain/task.py | acostapazo/event-manager | 0 | 34335 | from typing import Any, Dict
from meiga import Result, Error, Success
from petisco import AggregateRoot
from datetime import datetime
from taskmanager.src.modules.tasks.domain.description import Description
from taskmanager.src.modules.tasks.domain.events import TaskCreated
from taskmanager.src.modules.tasks.domain.t... | 2.390625 | 2 |
CSD_API/get_from_author.py | andrewtarzia/cage_collect | 0 | 34336 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Distributed under the terms of the MIT License.
"""
Script to search for and collect CIFs using a list of authors.
Author: <NAME>
Date Created: 1 Mar 2019
"""
import ccdc.search
import sys
import CSD_f
def write_entry(file, author, number, DOI, CSD, solvent, disord... | 3.15625 | 3 |
src/datastructure/stacks_ex1.py | Valeeswaran/tutorials | 0 | 34337 | import stacks1
def is_match(ch1, ch2):
match_dict = {
")": "(",
"]": "[",
"}": "{"
}
return match_dict[ch1] == ch2
def is_balanced(s):
stack = stacks1.Stack()
for ch in s:
if ch == '(' or ch == '{' or ch == '[':
stack.push(ch)
if ch == ')' or... | 3.84375 | 4 |
recommend.py | Srini96/Market-Basket-Analysis-with-Customer-Profiling-and-Exploratory-Analysis-using-Python | 1 | 34338 | # -*- coding: utf-8 -*-
"""
Created on Thu May 3 18:30:29 2018
@author: Koushik
"""
import pandas as pd
from IPython.display import display
import sys
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 29 19:04:35 2018
@author: Koushik
"""
#Python 2.x program for Speech Recognition
import re
#ent... | 3.046875 | 3 |
image_pipeline/stages/__init__.py | MarcoGlauser/image_pipeline | 0 | 34339 | <gh_stars>0
from image_pipeline.stages.crop_stage import CropStage
from image_pipeline.stages.jpeg_lossless_compression import JPEGLossLessCompressionStage
from image_pipeline.stages.jpeg_lossy_compression import JPEGLossyCompressionStage
from image_pipeline.stages.resize_stage import ResizeStage
pre_stages = [
R... | 1.476563 | 1 |
pyunitwizard/tests/test_get_form.py | dprada/pyunitwizard | 2 | 34340 | <reponame>dprada/pyunitwizard
import pytest
import pyunitwizard as puw
def test_string():
puw.configure.reset()
assert puw.get_form('1 meter')=='string'
def test_pint_quantity():
puw.configure.reset()
puw.configure.load_library(['pint'])
ureg = puw.forms.api_pint.ureg
q = ureg.Quantity(1.0,'me... | 2.328125 | 2 |
package/awesome_panel/express/bootstrap/modal.py | slamer59/awesome-panel | 179 | 34341 | <gh_stars>100-1000
"""In this module we provide the functionality of a Modal.
The Modal can be used to focus some kind of information like text, images, chart or an interactive
dashboard.
The implementation is inspired by
- https://css-tricks.com/considerations-styling-modal/
- https://codepen.io/henchme... | 2.78125 | 3 |
python/paddle/distributed/fleet/meta_optimizers/fp16_allreduce_optimizer.py | zmxdream/Paddle | 17,085 | 34342 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 1.53125 | 2 |
factory_djoy/__about__.py | jamescooke/factory_djoy | 26 | 34343 | <filename>factory_djoy/__about__.py
__name__ = 'factory_djoy'
__version__ = '2.2.0'
__author__ = '<NAME>'
__copyright__ = '2021, {}'.format(__author__)
__description__ = 'Factories for Django, creating valid model instances every time.'
__email__ = '<EMAIL>'
| 1.554688 | 2 |
garageofcode/sat/fifteen_puzzle.py | tpi12jwe/garageofcode | 2 | 34344 | <gh_stars>1-10
from collections import defaultdict
from sugarrush.solver import SugarRush
from garageofcode.common.utils import flatten_simple
N = 3
def get_state(solver):
# one-hot encoding
X = [[[solver.var() for _ in range(N**2)]
for _ in range(N)]
for _ ... | 2.46875 | 2 |
normalize.py | Zoomerhimmer/NT-Textual-Toolkit | 0 | 34345 | import re
import sys
import os
# Lists of same characters
alpha_equiv = ['Α','Ά','ά','ὰ','ά','ἀ','ἁ','ἂ','ἃ','ἄ','ἅ','ἆ','ἇ','Ἀ','Ἁ','Ἂ','Ἃ','Ἄ','Ἅ','Ἆ','Ἇ','ᾶ','Ᾰ','Ᾱ','Ὰ','Ά','ᾰ','ᾱ'] #Converts to α
alpha_subscripted = ['ᾀ','ᾁ','ᾂ','ᾃ','ᾄ','ᾅ','ᾆ','ᾇ','ᾈ','ᾉ','ᾊ','ᾋ','ᾌ','ᾍ','ᾎ','ᾏ','ᾲ','ᾴ','ᾷ','ᾼ','ᾳ'] #Converts to... | 2.953125 | 3 |
tests/test_conveniences.py | CSC-DPR/eopf-cpm | 0 | 34346 | import datetime
import os
import sys
from cmath import inf
from typing import Any
import hypothesis.extra.numpy as xps
import hypothesis.strategies as st
import numpy
import pytest
from hypothesis import assume, given
from eopf.product.utils import (
apply_xpath,
conv,
convert_to_unix_time,
is_date,
... | 2.421875 | 2 |
src/controller/src/depth_hold.py | Fzeak/sauvc-2019 | 0 | 34347 | <gh_stars>0
#!/usr/bin/env python
import rospy
from std_msgs.msgs import UInt16, Float32, String
from mavros_msgs.msg import Mavlink
from struct import pack, unpack
def listener():
rospy.init_node('depth_listener', anonymous=True)
pub_pressure = rospy.Publisher("depth_listener/pressure_diff", Float32, queue_size=10... | 2.125 | 2 |
energy/lopy_serial_external_sd/LoPy4_sd/main.py | niclabs/water-monitoring | 2 | 34348 | def get_lorawan_maximum_payload_size(dr):
mac_payload_size_dic = {'0':59, '1':59, '2':59, '3':123, '4':230, '5':230, '6':230}
fhdr_size = 7 #in bytes. Assuming that FOpts length is zero
fport_size = 1 #in bytes
frm_payload_size = mac_payload_size_dic.get(str(dr)) - fhdr_size - fport_size
ret... | 2.453125 | 2 |
forms_app/views.py | cs-fullstack-fall-2018/django-forms2-bachmanryan | 0 | 34349 | <reponame>cs-fullstack-fall-2018/django-forms2-bachmanryan
from django.shortcuts import render, redirect
from .models import FormModel
from datetime import datetime
def index(request):
form_list = FormModel.objects.all()
context = {'form_list': form_list}
return render(request, 'forms_app/index.html', con... | 2.15625 | 2 |
figurefirst/__init__.py | clbarnes/figurefirst | 1 | 34350 | <filename>figurefirst/__init__.py
from . import svg_to_axes
#reload(svg_to_axes)
from . import mpl_functions
from .svg_to_axes import FigureLayout
from . import mpl_fig_to_figurefirst_svg
from . import svg_util
from . import deprecated_regenerate
import sys
if sys.version_info[0] > 2: # regenerate uses importlib.utils... | 1.515625 | 2 |
dedsecuritybot.py | dedsecurity/DedSecuritySearch | 0 | 34351 | <gh_stars>0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import pandas as pd
import json
import nltk
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.layers import Input, Embedding, LSTM , Dense,GlobalMaxPooling1D,Flatten
from tensorflow.keras.pre... | 2.46875 | 2 |
tests/html/inline_builder_test.py | a-pompom/Python-markdownParser | 0 | 34352 | import pytest
from app.html.inline_builder import InlineBuilder, LinkBuilder, CodeBuilder, ImageBuilder
from app.markdown.inline_parser import InlineParser, LinkParser, CodeParser, ImageParser
from app.settings import setting
class TestInlineBuilder:
""" Inline要素からHTML文字列が得られるか検証 """
# HTML組み立て
@pytest.... | 2.578125 | 3 |
lab8/src/main.py | YaelBenShalom/Intro-to-AI | 0 | 34353 | import common
import student_code
import array
class bcolors:
RED = "\x1b[31m"
GREEN = "\x1b[32m"
NORMAL = "\x1b[0m"
def read_data(training_data, test_data1, gold_data1, filename):
data = array.array('f')
test = array.array('f')
with open(filename, 'rb') as fd:
data.... | 2.875 | 3 |
webapp/api/Model/basic.py | SCcagg5/My_Youtube | 3 | 34354 | from bottle import request, response, HTTPResponse
import os, datetime, re
import json as JSON
import jwt
class auth:
def gettoken(mypass):
secret = str(os.getenv('API_SCRT', '!@ws4RT4ws212@#%'))
password = str(os.getenv('API_PASS', 'password'))
if mypass == password:
... | 2.71875 | 3 |
data_sniffer/urls.py | thefedoration/django-data-sniffer | 0 | 34355 | from django.conf.urls import include, url
from django.conf import settings
from .views import data_sniffer_health_check
if settings.DATA_SNIFFER_ENABLED:
urlpatterns = [
url(r'^(?P<key>[-\w]+)', data_sniffer_health_check, name="data_sniffer_health_check"),
]
else:
urlpatterns = []
| 1.59375 | 2 |
crtauth/client.py | spotify/crtauth | 90 | 34356 | <filename>crtauth/client.py
# Copyright (c) 2011-2017 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 appl... | 2.625 | 3 |
editor/api/terminal/endpoints/terminal.py | dporr/skf-editor | 3 | 34357 | <filename>editor/api/terminal/endpoints/terminal.py
from flask import request
from flask_restplus import Resource
from editor.api.terminal.business import get_terminal_output
from editor.api.terminal.serializers import terminal_response, terminal_cmd
from editor.api.restplus import api
ns = api.namespace('terminal', d... | 2.484375 | 2 |
mediumwave/migrations/0011_transmitter_iso.py | soundelec/mwradio | 0 | 34358 | # Generated by Django 2.1.2 on 2018-10-19 14:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mediumwave', '0010_auto_20181017_1937'),
]
operations = [
migrations.AddField(
model_name='transmitter',
name='iso',... | 1.53125 | 2 |
3_MapReduce Programming on MovieLens Data/solution/MapReduce/code/userReducer.py | minakoyang/YY_Distributed_Cluster_Computing | 0 | 34359 | #!/usr/bin/env python
import sys
import csv
import json
mostRatingUser = None
mostRatingCount = 0
mostRatingInfo = None
for line in sys.stdin:
line = line.strip()
user, genreString = line.split("\t", 1)
genreInfo = json.loads(genreString)
if not mostRatingUser or len(genreInfo) > mostRatingCount:
... | 3.25 | 3 |
src/MockingBirdOnlyForUse/logger.py | Diaosi1111/MockingBirdOnlyForUse | 0 | 34360 | <gh_stars>0
import logging
import os
import sys
import time
LOG_LEVEL = logging.INFO
OPEN_CONSOLE_LOG = True
OPEN_FILE_LOG = False
LOG_FILE_PATH = None
LOG_NAME = "null"
###############################################################################################################
# 初始化日志
def _create_logger(
... | 2.375 | 2 |
tools/GetImages.py | vicyangworld/WaterDispenserEye | 0 | 34361 | <reponame>vicyangworld/WaterDispenserEye<filename>tools/GetImages.py
# -*- coding: utf-8 -*-
import cv2
import sys
import os
# 定义旋转rotate函数
def rotate(image, angle, center=None, scale=1.0):
# 获取图像尺寸
(h, w) = image.shape[:2]
print(image.shape)
# 若未指定旋转中心,则将图像中心设为旋转中心
if center is None:
ce... | 2.59375 | 3 |
tests/test_padondehoy.py | kengru/Giru | 3 | 34362 | <reponame>kengru/Giru<filename>tests/test_padondehoy.py
from unittest import TestCase
from giru.core.commands import PaDondeHoy
from tests.mocks import MockBot, MockUpdate
class TestPaDondeHoy(TestCase):
def test_catalogue_response_same_chat_same_day(self):
bot = MockBot()
update = MockUpdate()
... | 2.8125 | 3 |
ircConnection.py | mutexlox/NO-FIFTH-GLYPH | 1 | 34363 | <reponame>mutexlox/NO-FIFTH-GLYPH
import socket
import select
import config
class IRCConnection:
def __init__(self, serverName, port=6667):
self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.connection.connect((serverName, port))
self.connection.setblocking(0)
de... | 2.875 | 3 |
lesson-08/test_m.py | rafaelmartinsbuck/ai-for-trading | 1 | 34364 | <filename>lesson-08/test_m.py
import pandas as pd
import numpy as np
df = pd.DataFrame({"A":[1,2,3,4], "B":[5,6,7,8]})
print(df) | 3.734375 | 4 |
services/swimmer_service.py | Design-Patterns-Project-Group/swimming-mangement-in-python | 0 | 34365 | <filename>services/swimmer_service.py
import sys, os.path
sys.path.append(os.path.abspath('..'))
from models import *
from . import AbstractSwimmerService
class SwimmerService(AbstractSwimmerService):
def __init__(self):
# assume this is a database
self._data_store = [
{
... | 3 | 3 |
script.py | inforkgodara/python-network-scanner | 0 | 34366 | import socket
from datetime import datetime
# Author @inforkgodara
ip_address = input("IP Address: ")
splitted_ip_digits = ip_address.split('.')
dot = '.'
first_three_ip_digits = splitted_ip_digits[0] + dot + splitted_ip_digits[1] + dot + splitted_ip_digits[2] + dot
starting_number = int(input("Starting IP Number: "... | 3.5625 | 4 |
modules/2.79/bpy/types/CyclesMeshSettings.py | cmbasnett/fake-bpy-module | 0 | 34367 | <gh_stars>0
class CyclesMeshSettings:
pass
| 1.164063 | 1 |
uibuilder/backend/__init__.py | stonewell/pyuibuilder | 1 | 34368 | <filename>uibuilder/backend/__init__.py<gh_stars>1-10
#__init__.py backend
import os
import sys
import logging
from importlib import import_module
L = logging.getLogger('backend')
def create_widget(node):
'''
create widget based on xml node
'''
_widget = None
if 'impl' in node.attrib:
try... | 2.328125 | 2 |
CondTools/Geometry/python/HGCalParametersWriter_cff.py | ckamtsikis/cmssw | 852 | 34369 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from CondTools.Geometry.HGCalEEParametersWriter_cfi import *
from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
dd4hep.toModify(HGCalEEParametersWriter,
fromDD4Hep = cms.bool(True)
)
HGCalHESiParametersWriter = HGCalEEParametersWr... | 1.296875 | 1 |
Transition_examples_NCL_to_PyNGL/streamlines/TRANS_streamline.py | 1271756664/-xESMF | 54 | 34370 | <filename>Transition_examples_NCL_to_PyNGL/streamlines/TRANS_streamline.py
#
# File:
# TRANS_streamline.py
#
# Synopsis:
# Illustrates how to create a streamline plot
#
# Categories:
# streamline plot
#
# Author:
# <NAME>, based on NCL example
#
# Date of initial publication:
# September 2018
#
# ... | 2.65625 | 3 |
src/normalise.py | amystar101/fingerprint-image-enhancement | 1 | 34371 | <reponame>amystar101/fingerprint-image-enhancement<filename>src/normalise.py
#function to normalise image
#setting new mean = 1, and new varriance = 1
import numpy as np
import math
def normalise(img,new_mean = 1.0,new_variance = 1.0):
print("Normalising the image")
print("setting new mean = "+str(new_mean)+"... | 3.5625 | 4 |
tests/photos.py | DennyWeinberg/photoprism | 1 | 34372 | <reponame>DennyWeinberg/photoprism
import unittest
from photoprism import Client
class TestClass(unittest.TestCase):
def test_upload():
client = Client()
client.upload_photo('20210104_223259.jpg', b'TODO', album_names=['Test Album'])
| 2.328125 | 2 |
simulate.py | mikedigriz/Brave-Trigger | 1 | 34373 | # Simulate user activity for Windows
# Can trigger Brave Ads
import random
from time import sleep
import pydirectinput
import os
# clear log function
def cls():
os.system('cls' if os.name == 'nt' else 'clear')
# main simulate function
def simulate():
while True:
# u can change x,y with your screen ... | 3.265625 | 3 |
modules/module8/extra/manual_predict_demand.py | shourya01/power_data_analytics_tools | 1 | 34374 | <filename>modules/module8/extra/manual_predict_demand.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
counties_drop_list = ["Year", "Los Angeles County", "Merced County", "Riverside County", "San Diego County", "San Mateo County", "Santa Barbara County", "Santa Clara County", "Santa Cruz Cou... | 3.734375 | 4 |
config.py | vsmelov/neural-music | 2 | 34375 | # coding: utf-8
import os
base_dir = os.path.dirname(os.path.realpath(__file__))
music_dir = os.path.join(base_dir, 'music-3')
data_dir = os.path.join(base_dir, 'data-3')
weights_dir = os.path.join(data_dir, 'weights')
weights_file = os.path.join(weights_dir, 'weights')
if not os.path.exists(data_dir):
os.maked... | 2.484375 | 2 |
tests/conftest.py | BookOps-CAT/ChangeSubject | 1 | 34376 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import pytest
from pymarc import Field, Record
@pytest.fixture
def fake_subfields():
return ["a", "subA", "x", "subX1", "x", "subX2", "z", "subZ."]
@pytest.fixture
def fake_subjects(fake_subfields):
return [
Field(tag="600", indicators=["1", "0"], subfields=... | 2.140625 | 2 |
src/lexer_rules2.py | ezielramos/cool-compiler-2021 | 0 | 34377 | from TOKEN import LexToken
class Lexer:
def __init__(self,text):
self.my_bool = False
self.result = ''
self.names = {
"case" : "CASE",
"class" : "CLASS",
"else" : "ELSE",
"esac" : "ESAC",
"fi" : "FI",
"if" : "IF",
... | 2.90625 | 3 |
UCI/abalone/abalone.py | tqtifnypmb/ML | 0 | 34378 | import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
from sklearn import feature_selection as fs
from sklearn import naive_bayes
from sklearn import model_selection
from sklearn import metrics
from sklearn import linear_model
from sklearn import svm
from imblearn.under_sampling import Ne... | 2.53125 | 3 |
os_migrate/plugins/filter/stringfilter.py | jbadiapa/os-migrate | 35 | 34379 | <filename>os_migrate/plugins/filter/stringfilter.py<gh_stars>10-100
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from pprint import pformat
import re
from ansible import errors
def stringfilter(items, queries, attribute=None):
"""Filter a `items` list according to a li... | 2.84375 | 3 |
src/qgis_ros/core/translators/wireless_msgs.py | acfrmarine/qgis_ros | 31 | 34380 | from wireless_msgs.msg import Connection
from .translator import Translator, TableTranslatorMixin
class ConnectionTranslator(Translator, TableTranslatorMixin):
messageType = Connection
geomType = Translator.GeomTypes.NoGeometry
@staticmethod
def translate(msg):
# Some forks of wireless_msgs... | 2.421875 | 2 |
Lab11/BacktrackingRecursive.py | alexnaiman/Fundamentals-Of-Programming---Lab-assignments | 4 | 34381 | <filename>Lab11/BacktrackingRecursive.py
l = ["+", "-"]
def backRec(x):
for j in l:
x.append(j)
if consistent(x):
if solution(x):
solutionFound(x)
backRec(x)
x.pop()
def consistent(s):
return len(s) < n
def solution(s):
... | 3.765625 | 4 |
RBM.py | alibell/binary_rbm | 0 | 34382 | <filename>RBM.py
import numpy as np
def sigmoid(X):
"""sigmoid
Compute the sigmoid function
Parameters
----------
X: numpy array
Output:
-------
Numpy array of the same size of X
"""
return 1/(1+np.exp(-X))
class binary_RBM ():
def __init__ (self, q, max_iter=300, batch... | 3.609375 | 4 |
Day 07/Anagrams.py | sandeep-krishna/100DaysOfCode | 0 | 34383 | <reponame>sandeep-krishna/100DaysOfCode<filename>Day 07/Anagrams.py
'''
Anagrams
Given two strings, a and b , that may or may not be of the same length, determine the minimum number of character deletions required to make a and b anagrams. Any characters can be deleted from either of the strings.
Input :
test cases,... | 3.765625 | 4 |
bookstore/lib/green/__init__.py | Inveracity/python-grpc-betterproto-quartz | 0 | 34384 | <gh_stars>0
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: green.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict, List
import betterproto
from betterproto.grpc.grpclib_server import ServiceBase
import grpclib
class GreenColors(betterproto.Enum):
... | 2.03125 | 2 |
install-git-config-upstream.py | omunroe-com/cobaltdepottools | 0 | 34385 | """For each repo in DEPS, git config an appropriate depot-tools.upstream.
This will allow git new-branch to set the correct tracking branch.
"""
import argparse
import hashlib
import json
import os
import sys
import textwrap
import gclient_utils
import git_common
def _GclientEntriesToString(entries):
entries_str ... | 2.1875 | 2 |
examples/visualise_labels.py | meyerjo/simple-waymo-open-dataset-reader | 0 | 34386 | <gh_stars>0
# Copyright (c) 2019, <NAME>, Durham University
#
# 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.78125 | 3 |
utils.py | ProRansum/site-scanner | 0 | 34387 | import os
import socket
import codecs
import urllib3
from urllib.parse import urlparse
def __process__(command):
try:
process = os.popen(command)
results = str(process.read())
return results
except Exception as e:
raise e
def create_dir(directory):
if not os.path.exists(directory):
os.makedirs(direct... | 3.15625 | 3 |
finnhub/models/filing.py | gavinjay/finnhub-python | 0 | 34388 | <reponame>gavinjay/finnhub-python
# coding: utf-8
"""
Finnhub API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import... | 1.890625 | 2 |
year_2019/day_11_2019.py | TheTomcat/AdventOfCode | 0 | 34389 | from collections import defaultdict
from typing import List, Any, Tuple
from util.helpers import solution_timer
from util.input_helper import read_entire_input
from util.console import console
from year_2019.intcode import IntCode, parse
data = read_entire_input(2019,11)
def run_robot(data:List[str], init=0):
deb... | 3.296875 | 3 |
Life.py | lianwt115/python_pygame | 1 | 34390 | <filename>Life.py<gh_stars>1-10
# 子弹
import pygame
class Life(pygame.sprite.Sprite):
def __init__(self, img, init_pos):
pygame.sprite.Sprite.__init__(self)
self.image = img
self.rect = self.image.get_rect()
self.rect.topleft = init_pos
def update(self):
self.kill()
| 2.75 | 3 |
course_selection/scrape_parse.py | PrincetonUSG/ReCal | 1 | 34391 | <reponame>PrincetonUSG/ReCal
"""
Scrapes OIT's Web Feeds to add courses and sections to database.
Procedure:
- Get list of departments (3-letter department codes)
- Run this: http://etcweb.princeton.edu/webfeeds/courseofferings/?term=current&subject=COS
- Parse it for courses, sections, and lecture times (as recurrin... | 3.09375 | 3 |
wxRavenGUI/application/core/wxViewsManager.py | sLiinuX/wxRaven | 11 | 34392 | <reponame>sLiinuX/wxRaven
'''
Created on 13 déc. 2021
@author: slinux
'''
import inspect
from wxRavenGUI.view import wxRavenAddView
from wxRavenGUI.application.wxcustom.CustomDialog import wxRavenCustomDialog
import wx
import wx.aui
import logging
from .jobs import *
class ViewsManager(object):
'''
cla... | 1.429688 | 1 |
python/image-tools/adjust-exif-timestamp.py | bmaupin/graveyard | 1 | 34393 | #!/usr/bin/env python
import datetime
import optparse
import os
import os.path
import struct
import sys
# sudo pip3 install piexif
import piexif
# Make this negative to subtract time, e.g.:
# -datetime.timedelta(hours=5, minutes=9)
#TIME_ADJUSTMENT = datetime.timedelta(hours=5, minutes=9)
#TIME_ADJUSTMENT = datetim... | 2.9375 | 3 |
change_funname.py | poojadhoble32/python-projects | 0 | 34394 | def old(name,age):
print(f"my name is {name} and age is {age}")
old as new
new("pooja",23)
| 2.984375 | 3 |
idgo_admin/views/sld_preview.py | neogeo-technologies/idgo | 0 | 34395 | <filename>idgo_admin/views/sld_preview.py
# Copyright (c) 2017-2021 Neogeo-Technologies.
# 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/l... | 1.914063 | 2 |
FM/deepFM.py | sameul-yuan/markdowns | 0 | 34396 | import os
import sys
import numpy as np
import pandas as pd
import tensorflow as tf
from losses import focal_loss,weighted_binary_crossentropy
from utils import Dataset
class DeepFM(object):
def __init__(self, params):
self.feature_size = params['feature_size']
self.field_size = params['field_size'... | 2.234375 | 2 |
pfa.py | JonathanSilver/pyKT | 1 | 34397 | import numpy as np
from math import log
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score, mean_squared_error, mean_absolute_error, classification_report
from math import sqrt
import json
from pprint import pprint
import argparse
parser = argparse.ArgumentParser(f... | 2.5 | 2 |
apps/web/api/urls.py | rubmu/QuestBot | 16 | 34398 | <gh_stars>10-100
from django.urls import path
from .views import ProcessWebHookAPIView
urlpatterns = [
path(
'webhook/<hook_id>/',
ProcessWebHookAPIView.as_view(),
name='hooks-handler'
),
]
| 1.382813 | 1 |
databand_airflow_monitor.py | databand-ai/databand_templates | 4 | 34399 | <gh_stars>1-10
import logging
import os
from datetime import timedelta
from airflow import settings
from airflow.hooks.base_hook import BaseHook
from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.utils.dates import days_ago
CHECK_INTERVAL = 10 # Sleep time (in seco... | 2.140625 | 2 |