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 |
|---|---|---|---|---|---|---|
app.py | dylan0stewart/data-science | 0 | 12767051 | # https://spotipy.readthedocs.io/en/2.13.0/
# pip install spotipy --upgrade
# pipenv install python-dotenv
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import sys
import time
from flask import Flask, jsonify, Response, render_template, request
from flask_sqlalchemy import SQLAlchemy
import pandas ... | 2.65625 | 3 |
avista_base/auth/user.py | isu-avista/base-server | 0 | 12767052 | <reponame>isu-avista/base-server
from avista_base.auth import bp
from avista_data.user import User
from flask import request, jsonify, current_app
from avista_base.auth import role_required
from avista_data.role import Role
@bp.route('/api/users', methods=['POST'])
@role_required(Role.ADMIN)
def create_user():
if... | 2.421875 | 2 |
main.py | sainitishkumar/Song-Identifier | 3 | 12767053 | # # -*- coding: utf-8 -*-
# from chatterbot import ChatBot
# bot = ChatBot(
# "Math & Time Bot",
# logic_adapters=[
# "chatterbot.logic.MathematicalEvaluation",
# "chatterbot.logic.TimeLogicAdapter"
# ],
# input_adapter="chatterbot.input.VariableInputTypeAdapter",
# output_adapter=... | 2.546875 | 3 |
Scenes/__init__.py | OrIOg/TronRacerTest | 0 | 12767054 | <gh_stars>0
from Scenes.Game import Scene as Game | 1.015625 | 1 |
nxt/plugins/example.py | dalteocraft/nxt | 53 | 12767055 | from nxt.tokens import register_token
PREFIX = 'ex::'
def detect_token_type(value):
return value.startswith(PREFIX)
def resolve_token(stage, node, value, layer, **kwargs):
value = stage.resolve(node, value, layer, **kwargs)
# Reverses given value
return value[::-1]
register_token(PREFIX, detect_t... | 2.453125 | 2 |
wings/trade.py | mitakash/hummingbot | 0 | 12767056 | <reponame>mitakash/hummingbot
#!/usr/bin/env python
from collections import namedtuple
from typing import (
List,
Dict
)
import pandas as pd
from wings.order_book_row import OrderBookRow
from wings.events import TradeType
class Trade(namedtuple("_Trade", "symbol, side, price, amount")):
symbol: str
... | 2.890625 | 3 |
pyefun/networkUtil.py | nobodxbodon/pyefun | 1 | 12767057 | <reponame>nobodxbodon/pyefun<filename>pyefun/networkUtil.py
# -*- coding:utf-8 -*-
import sys
import requests
from .public import *
from requests.adapters import HTTPAdapter
@异常处理返回类型逻辑型
def 网页_取外网IP(返回地区=False):
'如果设置返回地区则返回两个参数,ip,地区'
header = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWe... | 2.578125 | 3 |
scripts/disaster_recovery/process_dlq.py | ministryofjustice/staff-device-logging-infrastructure | 1 | 12767058 | <reponame>ministryofjustice/staff-device-logging-infrastructure<filename>scripts/disaster_recovery/process_dlq.py
#!/usr/bin/env python
"""
Move all the messages from one SQS queue to another.
Usage: Run from Makefile. Run make process-dead-letter-queue and add required values
"""
import boto3
import itertools
impor... | 2.125 | 2 |
external/loaders/tests/test_stacking.py | ai2cm/fv3net | 1 | 12767059 | import loaders
import xarray as xr
import numpy as np
from loaders._utils import SAMPLE_DIM_NAME
import pytest
def test_multiple_unstacked_dims():
na, nb, nc, nd = 2, 3, 4, 5
ds = xr.Dataset(
data_vars={
"var1": xr.DataArray(
np.zeros([na, nb, nc, nd]), dims=["a", "b", "c",... | 2.21875 | 2 |
prisitri/urls.py | soslaio/agreg | 0 | 12767060 | <filename>prisitri/urls.py
from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from core.urls import corepatterns
from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
TokenVerifyVie... | 1.734375 | 2 |
Python/sWAP cASE.py | MonwarAdeeb/HackerRank-Solutions | 0 | 12767061 | def swap_case(s):
swapped = s.swapcase()
return swapped
| 2.671875 | 3 |
doorman/models.py | ESGuardian/doorman-docker | 614 | 12767062 | # -*- coding: utf-8 -*-
import datetime as dt
import string
import uuid
from flask_login import UserMixin
from doorman.database import (
Column,
Table,
ForeignKey,
Index,
Model,
SurrogatePK,
db,
reference_col,
relationship,
ARRAY,
JSONB,
INET,
declared_attr,
)
from ... | 2.171875 | 2 |
tests/test_pandas.py | ehw-fit/py-paretoarchive | 1 | 12767063 | from paretoarchive.pandas import pareto
import pandas as pd
def test_df():
df = pd.DataFrame(
[[1, 3, 3], [1, 2, 3], [1, 1, 2]], columns=["a", "b", "c"]
)
assert (pareto(df, ["a", "b"]).index == [2]).all()
assert (pareto(df, ["a", "b", "c"]).index == [2]).all()
assert (pareto(df, ["a", "... | 3.0625 | 3 |
quadclass/seqlearn.py | vavrusa/seqalpha | 2 | 12767064 | <gh_stars>1-10
#!/usr/bin/env python
import re
import sys, getopt
import pylab as pl
from sklearn.metrics import roc_curve, auc
from matplotlib.lines import Line2D
def load_classlist(source = 'gqclass.tsv'):
''' Load sequence classlist. '''
gq_classlist = dict()
with open(source) as datafile:
for l... | 2.421875 | 2 |
src/wagtail_localize_panel/views.py | Gandi/wagtail-localize-panel | 1 | 12767065 | <filename>src/wagtail_localize_panel/views.py<gh_stars>1-10
import logging
from django.template.loader import render_to_string
from .models import get_missing_translations_stat
log = logging.getLogger(__name__)
class WorkflowPagesToTranslatePanel:
name = "workflow_pages_to_translate"
order = 100
def _... | 2.140625 | 2 |
sged/data.py | pygongnlp/gramcorrector | 5 | 12767066 | from torch.utils.data import Dataset
from utils import load_data, get_labels
class SGEDDataset(Dataset):
def __init__(self, file_path, mode):
src_lst, trg_lst = load_data(file_path, mode)
self.src_lst = src_lst
self.trg_lst = trg_lst
self.labels = get_labels(src_lst, trg_lst)
d... | 2.59375 | 3 |
miniml/tensor.py | oniani/miniml | 3 | 12767067 | # type: ignore
"""
A Tensor module on top of Numpy arrays.
TODO: Implement the reverse mode autodiff to compute gradients. It will have
to go backward through the computation graph.
"""
from __future__ import annotations
from typing import Union
import os
import pkgutil
import numpy as np
import pyopencl as ... | 2.8125 | 3 |
fftbg/download.py | rainbowbismuth/birb-brains-bot | 1 | 12767068 | import json
import logging
from datetime import datetime
import requests
from fftbg.config import FFTBG_API_URL, TOURNAMENTS_ROOT
LOG = logging.getLogger(__name__)
def get_tournament_list():
j = requests.get(f'{FFTBG_API_URL}/api/tournaments?limit=6000').json()
return [(t['ID'], datetime.fromisoformat(t['L... | 2.53125 | 3 |
Craps/testGame.py | Kevin7196/CrapsIsFun | 0 | 12767069 | __author__ = '<NAME>'
from craps import CrapsGame
aCrapsGame = CrapsGame()
print(aCrapsGame.getCurrentBank())
aCrapsGame.placeBet(50)
aCrapsGame.throwDice()
aCrapsGame.throwDice()
print(aCrapsGame.getCurrentBank()) | 2.296875 | 2 |
nevergrad/optimization/test_externalbo.py | juliendehos/nevergrad | 0 | 12767070 | <reponame>juliendehos/nevergrad<gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import pytest
import numpy as np
import nevergrad as ng
from .optimizerlib imp... | 1.914063 | 2 |
code/GA.py | xijunlee/SPC-POSM | 0 | 12767071 | import math
import random
from random import randint
import copy
from sklearn.metrics import mean_squared_error
import numpy as np
from pyspark import SparkContext, SparkConf
import time
import pandas as pd
import sys
class Chromosome:
def __init__(self):
self.geneSerial = []
self.v = []
se... | 2.46875 | 2 |
elements-of-programming-interviews/10.0-balanced-binary-tree.py | vtemian/interviews-prep | 8 | 12767072 | <filename>elements-of-programming-interviews/10.0-balanced-binary-tree.py<gh_stars>1-10
from typing import List, Tuple, Optional
class Node:
def __init__(self, val: int, left: 'Node' = None, right: 'Node' = None):
self.val = val
self.left = left
self.right = right
def is_balanced(tree: N... | 3.75 | 4 |
code/consolefitness.py | ksu-is/workoutmanager | 1 | 12767073 | <filename>code/consolefitness.py
'''
grade tracking program - think through the goal up front- what is the task and design?
needs to enable several basic functions for teachers
needs to have login to protect the student data
'''
#import libraries first
import statistics as s
#add constants next
admins = {'jasmine':'<P... | 3.875 | 4 |
opacus/tests/dpdataloader_test.py | techthiyanes/opacus | 0 | 12767074 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 2.21875 | 2 |
fft_conv_pytorch/__init__.py | alexhagen/fft-conv-pytorch | 0 | 12767075 | from fft_conv_pytorch.fft_conv import FFTConv1d, FFTConv2d, FFTConv3d, fft_conv
| 1.117188 | 1 |
service/model.py | eifuentes/api-imagenet-1k | 0 | 12767076 | import json
import logging
import requests
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as vtransforms
from torchvision.models import squeezenet1_0, squeezenet1_1
RESCALE_SIZE = 256
CROP_SIZE = 224
IMAGENET_CLASS_MAP = 'imagenet_class_index.json'
logger = logging.... | 2.46875 | 2 |
pubsub/pubsub-pipe-image/pubsub-to-bigquery.py | eyenAFS/TwitterKubeBQ | 0 | 12767077 | <gh_stars>0
#!/usr/bin/env python
# Copyright 2015 Google Inc. 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
#
# Unl... | 2.375 | 2 |
sis_provisioner/tests/dao/test_pws.py | uw-it-aca/bridge-sis-provisioner | 0 | 12767078 | <filename>sis_provisioner/tests/dao/test_pws.py
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.test import TestCase
from freezegun import freeze_time
from sis_provisioner.dao import DataFailureException
from sis_provisioner.dao.pws import (
get_person, is_prior_n... | 2.0625 | 2 |
doc_v3/views.py | julics129/clinic_v3 | 0 | 12767079 | <reponame>julics129/clinic_v3
from django.shortcuts import render
from django import forms
from .forms import appointment_form , contact_form
from .models import contact, appointment, department
import json
# Create your views here.
from django.http import HttpResponse
def home(request):
return render(request, 'new... | 2.296875 | 2 |
AIS/tests/test_S4_SR_class.py | juliotux/AIS | 0 | 12767080 | # -*- coding: utf-8 -*-
"""SPARC4 spectral response tests.
This script tests the operation of the SPARC4 spectral response classes.
"""
import os
import numpy as np
import pandas as pd
import pytest
from AIS.SPARC4_Spectral_Response import (
Abstract_SPARC4_Spectral_Response,
Concrete_SPARC4_Spectral_Respons... | 2.40625 | 2 |
prettyqt/statemachine/mouseeventtransition.py | phil65/PrettyQt | 7 | 12767081 | <reponame>phil65/PrettyQt
from __future__ import annotations
from prettyqt import statemachine
from prettyqt.qt import QtStateMachine
QtStateMachine.QMouseEventTransition.__bases__ = (statemachine.EventTransition,)
class MouseEventTransition(QtStateMachine.QMouseEventTransition):
pass
| 1.515625 | 2 |
api/importer/importer/domain/product_line.py | manisharmagarg/qymatix | 0 | 12767082 | <gh_stars>0
from datetime import datetime
class ProductLine():
def __init__(self, name):
super().__init__()
self._name = name #Column(String(255), nullable=False, unique=True)
self._product_class_id = None #Column(ForeignKey('product_class.id'), nullable=False, index=True)
self._... | 2.375 | 2 |
lst/12-functional.py | tilorenz/vorlesung-psu | 6 | 12767083 | from functools import partial,reduce
from math import sqrt
import inspect
def nargs(function):
print(inspect.getfullargspec(function))
def inc(x):
return x + 1
def compose(f, g):
return lambda x: f(g(x))
x = compose(inc, inc)
print(x(0))
def partial(f, arg0):
return lambda *args: f(arg0, *args)
de... | 3.125 | 3 |
src/build/fuchsia/boot_data_test.py | uszhen/naiveproxy | 3 | 12767084 | #!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import boot_data
import os
import unittest
from boot_data import _SSH_CONFIG_DIR, _SSH_DIR
class TestBootData(unittest.TestCase):
... | 2.03125 | 2 |
A5T8SQLite.py | qasimy123/assignment5-CMPUT291 | 0 | 12767085 | <reponame>qasimy123/assignment5-CMPUT291<gh_stars>0
from util import connect
import time
# Inner join reviews and listings table,
# filter for matching listing id and order by date.
FIND_RECENT_REVIEW = \
'''
select
r.comments
from
reviews r
where
r.listi... | 3.390625 | 3 |
imdb_scraper.py | hossainsadman/imdb-scraper | 0 | 12767086 | import numpy
import pandas
import requests
from bs4 import BeautifulSoup as bsoup
from time import sleep
from random import randint
# start and end of urls for imbd top 1000 movies site
URL_START = "https://www.imdb.com/search/title/?groups=top_1000&start="
URL_END = "&ref_=adv_nxt"
# data for each movie
titles = []
... | 2.84375 | 3 |
yats/connector.py | GaryOma/yats | 0 | 12767087 | <filename>yats/connector.py<gh_stars>0
import re
import math
import logging
from datetime import timedelta, timezone
from multiprocessing import Manager
from multiprocessing.pool import ThreadPool
from functools import partial
from yats.custom_datetime import CustomDateTime as datetime
from yats.twitter_request import... | 2.3125 | 2 |
thesis/src/connect.py | srinath009/breach | 21 | 12767088 | import socket
import select
import logging
import binascii
from os import system, path
import sys
import signal
from iolibrary import kill_signal_handler, get_arguments_dict, setup_logger
import constants
signal.signal(signal.SIGINT, kill_signal_handler)
class Connector():
'''
Class that handles the network c... | 2.34375 | 2 |
netmikoo4.py | lalitshankergarg/pylalit | 0 | 12767089 | #1/usr/bin/python3
import netmiko,time
#multi vendor library
device1={
'username' : 'lalit',
'password' : '<PASSWORD>',
'device_type' : 'cisco_ios',
'host' : '192.168.234.131'
}
#to connect to target device
#by checking couple of things connect handler will allow you to connect
device_connect=netmiko.ConnectHa... | 2.453125 | 2 |
data/utils.py | carmelrabinov/contrastive-domain-randomization | 5 | 12767090 | <reponame>carmelrabinov/contrastive-domain-randomization
import re
import shutil
import torch
from torchvision import transforms
import numpy as np
import os
from PIL import Image
import matplotlib.pyplot as plt
from scipy.ndimage.morphology import binary_dilation, generate_binary_structure
import cv2
action_files_s... | 2.234375 | 2 |
plantstuff/schema/ecology.py | christabor/plantstuff | 6 | 12767091 | <filename>plantstuff/schema/ecology.py
"""Locale specific data for the master Model.
TODO: add world countries, etc... granularity TBD.
"""
from neomodel import (
ArrayProperty as ListProp,
StructuredNode as Model,
StringProperty as StringProp,
)
US_COUNTIES = [
"alabama:autauga",
"alabama:baldwi... | 2.046875 | 2 |
tests/update_test.py | JULIELab/taxonupdate | 0 | 12767092 | <filename>tests/update_test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the taxonomy updater."""
from typing import cast
from taxonomy_update import make_variants, taxonomy2dict
from DictWriter import DictWriter
def test_allalpha():
"""Only the scientific name should get variants."""
stra... | 2.734375 | 3 |
direction_net/pano_utils/transformation.py | DionysisChristopoulos/google-research | 23,901 | 12767093 | <filename>direction_net/pano_utils/transformation.py
# coding=utf-8
# Copyright 2021 The Google Research 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... | 2.21875 | 2 |
layer.py | matiasinsaurralde/yowsup-json-rpc | 4 | 12767094 | <gh_stars>1-10
from yowsup.layers.interface import YowInterfaceLayer, ProtocolEntityCallback
from yowsup.layers.protocol_messages.protocolentities import TextMessageProtocolEntity
class EchoLayer(YowInterfaceLayer):
@ProtocolEntityCallback("message")
def onMessage(self, messageProto... | 2.21875 | 2 |
settings_azure.py | Reinaesaya/munchee | 3 | 12767095 | <filename>settings_azure.py
from munchee.settings import *
# Azure prod-specific variables config
DEBUG = True # temp DANGEROUS
ALLOWED_HOSTS = ["mchee.co"]
SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY = os.environ["LINKEDIN_KEY"]
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET = os.environ["LINKEDIN_SECRET"]
SECRET_KEY = os.environ["SECRET_KEY... | 1.554688 | 2 |
mnist/src/autoencoder.py | srungta/mnist-and-others | 0 | 12767096 | <reponame>srungta/mnist-and-others
from keras.layers import Input, Dense
from keras.models import Model
import numpy as np
from commonconstants import MNIST_FLATTENED_NORMALISED_PICKLE
from file_helper import read_from_pickle
from mnist_helper import get_mnist_data
# HYPERPARAMETERS
epochs = 10
encoding_dim = 32
batc... | 2.734375 | 3 |
LeetCode/_0001_0050/_043_MultiplyStrings.py | BigEggStudy/LeetCode-Py | 1 | 12767097 | <filename>LeetCode/_0001_0050/_043_MultiplyStrings.py<gh_stars>1-10
#-----------------------------------------------------------------------------
# Runtime: 84ms
# Memory Usage:
# Link:
#-----------------------------------------------------------------------------
class Solution:
def multiply(self, num1: str, n... | 3.40625 | 3 |
data_structures/linked_list/doubly_linked/__init__.py | kwahome/data-structures-and-algos | 0 | 12767098 | from .linked_list import DoublyLinkedList, Node
| 1.226563 | 1 |
test/test_trivial.py | chrisfoulon/C-PAC | 1 | 12767099 | <reponame>chrisfoulon/C-PAC
from nose.tools import ok_, eq_
def test_b():
"""
Raw, unparented test.
"""
assert 'b' == 'b'
def test_1_and_1():
assert 1+1 == 2
def test_sum():
eq_(1+1,2)
def test_failing_compare():
ok_(2>3, 'Expected failure')
| 2.296875 | 2 |
Analytics/Tweets/cleaning.py | nicklausong/BT4222-Text-Analysis-For-Stock-Returns-Prediction | 0 | 12767100 | #########################################################################
### Program clean tweets ###
### 1. spaCy POS tagging for relevant tweets (apple fruit vs iphone) ###
### 2. Sentiment analysis of tweets ###
### 3. Group tweets by d... | 2.421875 | 2 |
tutorials/generate_egoview_overlaid_vector_map.py | jhonykaesemodel/av2-api | 26 | 12767101 | # <Copyright 2022, Argo AI, LLC. Released under the MIT license.>
"""Generate MP4 videos with map entities rendered on top of sensor imagery, for all cameras, for a single log.
We use a inferred depth map from LiDAR to render only visible map entities (lanes and pedestrian crossings).
"""
import logging
import os
im... | 2.390625 | 2 |
var/spack/repos/builtin/packages/findutils/package.py | kkauder/spack | 2 | 12767102 | <reponame>kkauder/spack
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import re
class Findutils(AutotoolsPackage, GNUMirrorPackage):
"""The GN... | 1.53125 | 2 |
pitch/concurrency.py | georgepsarakis/pitch | 6 | 12767103 | from abc import abstractmethod
from concurrent import futures
class Pool(object):
def __init__(self, loops=1, concurrency=1):
self._concurrency = concurrency
self._loops = loops
@abstractmethod
@property
def executor_class(self) -> futures.Executor:
pass
def run(self, fn... | 3.484375 | 3 |
serif/model/impl/mention/noun_phrase_mention_model_ner_deduplication.py | BBN-E/ZS4IE | 7 | 12767104 | <filename>serif/model/impl/mention/noun_phrase_mention_model_ner_deduplication.py<gh_stars>1-10
import logging
from serif.model.mention_model import MentionModel
logger = logging.getLogger(__name__)
class NounPhraseMentionModelNERDeduplication(MentionModel):
def __init__(self, **kwargs):
super(NounPhrase... | 2.53125 | 3 |
DailyProgrammer/DP20140723B.py | DayGitH/Python-Challenges | 2 | 12767105 | <gh_stars>1-10
"""
[7/23/2014] Challenge#172 [Intermediate] Image Rendering 101...010101000101
https://www.reddit.com/r/dailyprogrammer/comments/2ba3nf/7232014_challenge172_intermediate_image_rendering/
#Description
You may have noticed from our
[easy](http://www.reddit.com/r/dailyprogrammer/comments/2ba3g3/7212014_c... | 2.859375 | 3 |
docs/examples/led_board_2.py | NotBobTheBuilder/gpiozero | 743 | 12767106 | from gpiozero import LEDBoard
from signal import pause
leds = LEDBoard(5, 6, 13, 19, 26, pwm=True)
leds.value = (0.2, 0.4, 0.6, 0.8, 1.0)
pause()
| 2.40625 | 2 |
src/gms/rem.py | hohe12ly/inundation-mapping | 2 | 12767107 | #!/usr/bin/env python3
from numba import njit, typeof, typed, types
import rasterio
import numpy as np
import argparse
import os
from osgeo import ogr, gdal
def rel_dem(dem_fileName, pixel_watersheds_fileName, rem_fileName, thalweg_raster):
"""
Calculates REM/HAND/Detrended DEM
Parameter... | 2.78125 | 3 |
src/reloadex/linux/reloader_linux.py | iljau/reloadex | 1 | 12767108 | <gh_stars>1-10
import ctypes
import os
import select
import shlex
import signal
import threading
import sys
import logging
from ctypes import c_int, byref, create_string_buffer
from timeit import default_timer
import reloadex.linux.shared
from reloadex.common.utils_app_starter import is_target_str_file
from reloadex.... | 1.445313 | 1 |
config.py | reillykeele/CMPUT404-assignment-webserver | 0 | 12767109 | class Config:
BUFFER_SIZE = 1024
ROOT = './www' | 1.242188 | 1 |
flaskr/db.py | elijah415hz/finances-flask | 0 | 12767110 | from sqlalchemy import create_engine
import os
FLASK_DB_URI = os.environ.get("FLASK_DB_URI")
# Create database connection
engine = create_engine(FLASK_DB_URI) | 2.1875 | 2 |
kitpy/common/__init__.py | YorkSu/kitpy | 0 | 12767111 | <reponame>YorkSu/kitpy<gh_stars>0
# -*- coding: utf-8 -*-
"""Common package."""
from kitpy.common import cache
from kitpy.common import interface
from kitpy.common import pattern
| 1.09375 | 1 |
scripts/mass_2_weight.py | architectureofthings/openmeta-vahana | 11 | 12767112 | <gh_stars>10-100
'''
# Name: mass_2_weight
# Company: MetaMorph, Inc.
# Author(s): <NAME>
# Email: <EMAIL>
# Create Date: 6/9/2017
# Edit Date: 6/9/2017
# Conversion of Airbus A^3's vahanaTradeStudy>reserveMission.mat code
# (located here: https://github.com/VahanaOpenSource/vahanaTradeStudy )
# to Python 2.7 for use ... | 2.25 | 2 |
src/snippets/06_linear_algebra.py | yvesbeutler/tyrannosaurus | 0 | 12767113 | from typing import List, Tuple, Callable
import math
# define some type alias
Vector = List[float]
Matrix = List[List[float]]
###################################
# Vector calculations
###################################
def add(v: Vector, w: Vector) -> Vector:
"""simple vector addition"""
assert len(v) == le... | 3.921875 | 4 |
help/urls.py | Shreyanshsachan/College-Predictor | 0 | 12767114 | <reponame>Shreyanshsachan/College-Predictor<filename>help/urls.py<gh_stars>0
from django.conf.urls import url
from . import views
app_name='HELP'
urlpatterns=[
url(r'^$',views.help_view,name='helpapp'),
] | 1.5 | 2 |
src/project_name/urls.py | konoufo/perfectstart | 0 | 12767115 | from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import RedirectView
from profiles.views import SignupView
from . import views
urlpatterns = [
url(r'^$', views.HomePage.as_view(), name=... | 2.03125 | 2 |
joshgordon/04/bingo.py | VisionistInc/-advent-of-code-2021 | 1 | 12767116 | <filename>joshgordon/04/bingo.py
from collections import defaultdict
import re
# shamelessly borrowed from https://stackoverflow.com/questions/2912231/is-there-a-clever-way-to-pass-the-key-to-defaultdicts-default-factory
# I've used this before and it's super awesome. It's a defaultdict except your lambda function get... | 3.03125 | 3 |
app/views.py | mugisha-thierry/online-shop | 1 | 12767117 | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Group
from django.shortcuts import render,redirect,get_object_or_404
from django.http import HttpResponse, Http404,HttpResponseRedirect
from django.contrib.auth.forms import UserCreationForm
from .models import Profile,Orde... | 2.0625 | 2 |
lib/dmcomm/protocol/barcode.py | dmcomm/dmcomm-python | 1 | 12767118 | # This file is part of the DMComm project by BladeSabre. License: MIT.
"""
`dmcomm.protocol.barcode`
=========================
Functions for generating EAN-13 patterns.
"""
# https://en.wikipedia.org/wiki/International_Article_Number
_START_END = "101"
_CENTRE = "01010"
_CODES = {
"L": ["0001101", "0011001", "00100... | 2.765625 | 3 |
lib/security.py | qvant/stackexchange_bot | 0 | 12767119 | <filename>lib/security.py
import base64
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
CONFIG_PARAM_SECRET_CONST = "2fggbre34AAftr54"
def is_password_encrypted(password: str) -> bool:
return password is no... | 2.78125 | 3 |
apollon/chain.py | ApollonChain/ApollonCore | 2 | 12767120 | <filename>apollon/chain.py<gh_stars>1-10
## Blockchain Object ##
class Blockchain:
# Es wird ein neues Blockchain Objekt erstellt
def __init__(self, RootConfig, ChainDB):
# Blockchain Daten
from threading import Lock
self.mempool = list()
self.root_conf = RootConfig
self.... | 2.46875 | 2 |
setup.py | wizardsoftheweb/wotw-cookiecutter-base | 0 | 12767121 | """This file sets up the package"""
from setuptools import setup
setup(
name='wotw-cookiecutter-base',
version='0.2.0',
packages=[],
)
| 1.203125 | 1 |
boxes/sensorgw/web/sensor_gateway.py | yagamy4680/myboxes | 0 | 12767122 | <gh_stars>0
#!/usr/bin/env python
from bottle import route, run, post, get, request, static_file
from optparse import OptionParser
myData = {}
@route('/hello')
def hello():
return "Hello World!\n"
@post('/api/data/<name>')
def updateData(name='hello'):
jsonData = request.json
print(jsonData)
myData[... | 2.625 | 3 |
rebuild_tool/rebuild_metadata.py | mcyprian/deps_visualization | 2 | 12767123 | import yaml
from collections import UserDict
from rebuild_tool.exceptions import IncompleteMetadataException, UnknownPluginException
from rebuild_tool.builder_plugins.builder_loader import available_builder_plugins
from rebuild_tool.pkg_source_plugins.pkg_source_loader import available_pkg_source_plugins
def get_file... | 2.21875 | 2 |
preprocess/thyroid_tissue_loc.py | PingjunChen/ThyroidGeneralWSI | 2 | 12767124 | # -*- coding: utf-8 -*-
import os, sys
import shutil
import tissueloc as tl
from tissueloc.load_slide import load_slide_img, select_slide_level
import numpy as np
from skimage import io, color
import cv2
if __name__ == "__main__":
slide_dir = "../data/TestSlides/Malignant"
save_dir = "../data/TestSlides/Mal... | 2.453125 | 2 |
worker.py | tcbegley/dash-rq-demo | 42 | 12767125 | <filename>worker.py<gh_stars>10-100
from rq import Connection, Worker
from dash_rq_demo import conn, queue
if __name__ == "__main__":
with Connection(conn):
w = Worker([queue])
w.work()
| 1.71875 | 2 |
Darlington/phase-2/FILE 1/O/day 83 solution/qtn3.py | darlcruz/python-challenge-solutions | 0 | 12767126 | # program that takes a text file as input and returns the number of words of a given text file.
def count_words(filepath):
with open(filepath) as f:
data = f.read()
data.replace(",", " ")
return len(data.split(" "))
print(count_words("words.txt")) | 4.3125 | 4 |
Mask_RCNN/forecut_pipeline/save_image.py | tobias-fyi/rmbg | 3 | 12767127 | <filename>Mask_RCNN/forecut_pipeline/save_image.py
"""ForeCut \\ Pipeline :: Save image(s)"""
import os
import skimage.io
from forecut_pipeline.pipeline import Pipeline
class SaveImage(Pipeline):
"""Pipeline task to save images."""
def __init__(self, src, path, image_ext="png"):
self.src = src
... | 2.71875 | 3 |
pypaste/pypaste.py | pypaste/pypaste | 0 | 12767128 | # -*- coding: utf-8 -*-
"""Main module."""
# from abc import ABC as _ABC
from contextlib import AbstractContextManager as _AbstractContextManager
from abc import abstractmethod as _abstractmethod
# from abc import abstractclassmethod as _abstractclassmethod
class PyPasteBase(_AbstractContextManager):
@property
... | 2.828125 | 3 |
erica/erica_legacy/elster_xml/grundsteuer/elster_data_representation.py | punknoir101/erica-1 | 0 | 12767129 | from dataclasses import dataclass
from typing import List, Optional
from erica.erica_legacy.elster_xml.common.basic_xml_data_representation import ENutzdaten, construct_basic_xml_data_representation
from erica.erica_legacy.elster_xml.grundsteuer.elster_eigentuemer import EAngFeststellung, EPersonData, EEigentumsverh, ... | 2.609375 | 3 |
plugins/osulib/utils/misc_utils.py | Jeglerjeg/pcbot | 0 | 12767130 | <reponame>Jeglerjeg/pcbot<filename>plugins/osulib/utils/misc_utils.py
import discord
from plugins.osulib import enums
from plugins.osulib.constants import timestamp_pattern
from plugins.osulib.config import osu_config
def get_diff(old: dict, new: dict, value: str, statistics=False):
""" Get the difference betwee... | 2.390625 | 2 |
backend/api/migrations/0006_auto_20181113_0325.py | sperrys/YEF_DEBUG | 2 | 12767131 | <gh_stars>1-10
# Generated by Django 2.1.1 on 2018-11-13 03:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0005_auto_20181113_0259'),
]
operations = [
migrations.RenameModel(
old_n... | 1.757813 | 2 |
Question Set 1 - (Selection Statement)/Version 5/main.py | Randula98/Python-For-Beginners | 6 | 12767132 | <reponame>Randula98/Python-For-Beginners<filename>Question Set 1 - (Selection Statement)/Version 5/main.py
#get the user input for Position
position = input("Position : ")
while position != "M" and position != "m" and position != "S" and position != "s":
print("Invalid Input")
position = input("Position : ")
... | 4.09375 | 4 |
MachineLearning(Advanced)/p6_graduation_project/process_dog.py | StudyExchange/Udacity | 0 | 12767133 | #! /usr/bin/env python
"""Run a YOLO_v2 style detection model on test images."""
import argparse
import colorsys
import imghdr
import os
import random
import numpy as np
from keras import backend as K
from keras.models import load_model
from PIL import Image, ImageDraw, ImageFont
from yad2k.models.keras_yolo import y... | 2.5 | 2 |
venv/Lib/site-packages/lunr/exceptions.py | star10919/drf | 2 | 12767134 | <gh_stars>1-10
from __future__ import unicode_literals
class BaseLunrException(Exception):
pass
class QueryParseError(BaseLunrException):
pass
| 1.570313 | 2 |
scripts/calcular_pagamentos_descontos_com variacao_das_taxas.py | GeisonIsrael/scripts_basicos_python | 0 | 12767135 | # Calcular o preço de um produto com % de desconto para pagamento a vista e % de juros para pagamento parcelado.
print('x=' * 80)
# AQUI FICA O VALOR DO PRODUTO.
preco = float(input('Qual o valor do produto ?R$ '))
# VALOR DO DESCONTO OU ACREŚIMO.
porcentagem = float(input('Desconto ou acréscimo para este produto em ... | 3.890625 | 4 |
test/unit/common/test_db.py | tsg-/swift-ec | 2 | 12767136 | <gh_stars>1-10
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 1.960938 | 2 |
web-api/python/ws.py | OpenBEL/openbel-framework-examples | 1 | 12767137 | try:
from suds.client import Client
from suds.wsse import *
except ImportError as ie:
print
print "You're missing suds, the lightweight SOAP python client."
print "(https://fedorahosted.org/suds/)"
print
raise ie
import logging
class WS:
'''
Creates the WS connection from the URL, ... | 2.75 | 3 |
scripts/quest/q23600e.py | G00dBye/YYMS | 54 | 12767138 | <reponame>G00dBye/YYMS
# Created by MechAviv
# Quest ID :: 23600
# Not coded yet
OBJECT_6 = sm.getIntroNpcObjectID(2159377)
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.sendDelay(900)
sm.moveCamera(False, 100, -307, -41)
sm.sendDelay(2604)
sm.setSpeak... | 1.742188 | 2 |
src/api/utils/initial_data.py | andela/andela-societies-backend | 1 | 12767139 | <filename>src/api/utils/initial_data.py
"""Sample Data for Initial Run.
This contains the sample initial data required for the test run of the system.
"""
import datetime
import os
import base64
import requests
from jose import ExpiredSignatureError, JWTError
from api.models import (
Center, Cohort, Society, Logg... | 2.4375 | 2 |
app/api/ambassador_routes.py | RyanGC93/Worldly | 6 | 12767140 | <filename>app/api/ambassador_routes.py
from flask import Blueprint
from flask_login import current_user, login_required
import json
from app.models import db, Event, Location, Ambassador, User, Review, PhotoGallery, EventCalendar, BookingCalendar
from sqlalchemy import exc
ambassador_routes = Blueprint('ambassadors',... | 2.421875 | 2 |
dqn/dqn_agent.py | ViacheslavBobrov/ReinforcementLearning | 0 | 12767141 | import random
from collections import deque
import numpy as np
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import Adam
class DQNAgent:
def __init__(self, state_size,
action_size,
memory_size,
hidden_layers_number,
... | 2.640625 | 3 |
api/migrations/0008_merge_20200313_1603.py | CMPUT404W20-Wed/CMPUT404-project-socialdistribution-tmp | 1 | 12767142 | <filename>api/migrations/0008_merge_20200313_1603.py
# Generated by Django 2.2.10 on 2020-03-13 16:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0007_auto_20200312_2152'),
('api', '0007_comment_contenttype'),
]
operations = [
]
| 1.085938 | 1 |
greentest/test__systemerror.py | Eugeny/gevent | 2 | 12767143 | import sys
import greentest
import gevent
from gevent.hub import get_hub
def raise_(ex):
raise ex
MSG = 'should be re-raised and caught'
class Test(greentest.TestCase):
error_fatal = False
def test_sys_exit(self):
self.start(sys.exit, MSG)
try:
gevent.sleep(0.001)
... | 2.53125 | 3 |
microbepy/common/isolate.py | ScienceStacks/MicrobEPy | 1 | 12767144 | <gh_stars>1-10
"""
Utilities for manipulating isolates and "generalized" isolates (e.g., lines).
Key conepts:
line (or ancestral line) - the experimental conditions under which an incubation is done (resistance + stiring)
line replica - instances of the same experimental conditions
transfer - the transfer number... | 2.234375 | 2 |
summary.py | bubbliiiing/facenet-keras | 39 | 12767145 | <filename>summary.py
#--------------------------------------------#
# 该部分代码只用于看网络结构,并非测试代码
#--------------------------------------------#
import os
from nets.facenet import facenet
if __name__ == "__main__":
input_shape = [160, 160, 3]
model = facenet(input_shape, len(os.listdir("./datasets")), bac... | 2.703125 | 3 |
Leander_Stephen_D'Souza/ROS/catkin_ws/src/android/src/joystick_publisher.py | leander-dsouza/MRM-Tenure | 2 | 12767146 | <gh_stars>1-10
#!/usr/bin/env python
import rospy
import socket
import serial
from std_msgs.msg import String
ob1 = String()
ser = serial.Serial('/dev/ttyUSB2', 115200)
HOST = '192.168.43.21' # HOST
PORT1 = 1234
BUFFER_SIZE = 1 # Normally 1024, but I want fast response
s=socket.socket(socket.AF_INET, socket.SOCK_ST... | 2.578125 | 3 |
LittleBigCode/code/ppc.py | ElodieQ/EPIDEMIUM-Season-3 | 0 | 12767147 | <reponame>ElodieQ/EPIDEMIUM-Season-3
"""
Preprocessing related functions
"""
import os
import pandas as pd
from PIL import Image
from pathlib import Path
import datetime
import numpy as np
import cv2
import matplotlib.pyplot as plt
import itertools
from sklearn.model_selection import train_test_split
from functools im... | 2.65625 | 3 |
test/registry/protocol_v2.py | kwestpharedhat/quay | 0 | 12767148 | <gh_stars>0
import hashlib
import json
from typing import Dict
from enum import Enum, unique
from image.docker.schema1 import (
DockerSchema1ManifestBuilder,
DockerSchema1Manifest,
DOCKER_SCHEMA1_CONTENT_TYPES,
)
from image.docker.schema2 import DOCKER_SCHEMA2_CONTENT_TYPES
from image.docker.schema2.manif... | 2.125 | 2 |
stino/pyarduino/arduino_params_file.py | huangxuantao/MyStino | 2 | 12767149 | <reponame>huangxuantao/MyStino<gh_stars>1-10
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# 1. Copyright
# 2. Lisence
# 3. Author
"""
Documents
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from . import base
... | 2.609375 | 3 |
tests/test_utils.py | jwsiegel2510/ESPEI | 0 | 12767150 | """
Test espei.utils classes and functions.
"""
import pickle
from tinydb import where
from espei.utils import ImmediateClient, PickleableTinyDB, MemoryStorage, \
flexible_open_string, add_bibtex_to_bib_database, bib_marker_map
from .fixtures import datasets_db, tmp_file
from .testing_data import CU_MG_TDB
MULTI... | 2.296875 | 2 |