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 |
|---|---|---|---|---|---|---|
jolly-jellyfish/src/django_meta/urls.py | Vthechamp22/summer-code-jam-2021 | 40 | 12788251 | """halfway URL Configuration"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path, include
urlpatterns = [
path('admin', admin.site.urls),
path('users/login', auth_views.L... | 1.632813 | 2 |
cms/views.py | rodrigo-pacheco/X-Serv-15.5-Django-CMS | 0 | 12788252 | from django.shortcuts import render
from cms.models import Pages
from django.http import HttpResponse
from django.http import HttpResponseNotFound
from django.core.exceptions import ObjectDoesNotExist
# Create your views here.
def slash(self):
response = ''
for Page in Pages.objects.all():
redirection... | 2.234375 | 2 |
pytorch/detectron2_test.py | cicicici/deeptensor | 1 | 12788253 | from __future__ import print_function
import torch
''' Env
pip install -U torch torchvision
pip install -U cython
pip install -U 'git+https://github.com/facebookresearch/fvcore.git' 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
git clone https://github.com/facebookresearch/detectron2 detectr... | 2.3125 | 2 |
sensor_adapter.py | lgm1989/rmep | 2 | 12788254 | from robot_base import RobotBase
class SensorAdapter(RobotBase):
"""
3.2.10 传感器转接板控制
https://robomaster-dev.readthedocs.io/zh_CN/latest/sdk/protocol_api.html#id43
"""
def get_adc(self, id, port):
"""
3.2.10.1. 传感器转接板 ADC 值获取
"""
cmd = "sensor_adapter adc id %d port... | 2.828125 | 3 |
FLASH4.2.1_save/tools/python/flmake/mv.py | mtsafarzadeh/FLASHverES | 1 | 12788255 | <filename>FLASH4.2.1_save/tools/python/flmake/mv.py
import os
import json
import shutil
# Relative imports needed!
from .. import FLASH_SRC_DIR
from . import logger
from .setup_globals import gvars
USAGE = ("Moves a flash run local sub-directory\n"
"from src to dst. Useful for managing\n"
"many run... | 2.515625 | 3 |
mim/Psi4.py | nbraunsc/MIM | 0 | 12788256 | <filename>mim/Psi4.py<gh_stars>0
import numpy as np
#import psi4
#psi4.core.set_output_file('output.dat', False)
class Psi4():
""" Psi4 Numpy quantum chemistry backend class
An instance of this class is passed into the Fragment class
"""
def __init__(self, theory=None, basis=None, tol=None, active_s... | 2.703125 | 3 |
catalog/migrations/0005_auto_20210406_1240.py | Dessand/local_library | 0 | 12788257 | # Generated by Django 3.1.7 on 2021-04-06 12:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0004_auto_20210405_1042'),
]
operations = [
migrations.AlterField(
model_name='book',
name='title',
... | 1.539063 | 2 |
exprimo/graph.py | Lagostra/exprimo | 3 | 12788258 | <gh_stars>1-10
"""
Graph representation of a Deep Neural Network.
This code is based off of corresponding code in the Paleo library. See license file in submodule.
Changes are made in order to support specific device assignment of layers.
"""
import json
from copy import deepcopy
import collections
from paleo import... | 2.546875 | 3 |
EDU-CF-R102/B.py | patwadeepak/codeforces | 0 | 12788259 | <filename>EDU-CF-R102/B.py<gh_stars>0
import math
def LCM(s, t):
n = len(s)
m = len(t)
s_count = {'a': 0, 'b': 0}
t_count = {'a': 0, 'b': 0}
for char in s:
s_count[char] += 1
for char in t:
t_count[char] += 1
if s_count['a']/s_count['b'] == t_count['... | 3.46875 | 3 |
apps/modules/theme_setting/process/nav_setting.py | Bension/osroom | 579 | 12788260 | <gh_stars>100-1000
#!/usr/bin/env python
# -*-coding:utf-8-*-
# @Time : 2019/12/2 14:43
# @Author : <NAME>
from bson import ObjectId
from flask import request, g
from flask_babel import gettext
from apps.app import mdbs, cache
from apps.core.flask.reqparse import arg_verify
from apps.utils.format.obj_format im... | 2.28125 | 2 |
iqmon/scripts/ingest_script.py | joshwalawender/IQMon | 9 | 12788261 | from keckdrpframework.core.framework import Framework
from keckdrpframework.config.framework_config import ConfigClass
from keckdrpframework.models.arguments import Arguments
from keckdrpframework.utils.drpf_logger import getLogger
import subprocess
import time
import argparse
import sys
import traceback
impor... | 2.125 | 2 |
01_label_uncertainty/models.py | xiaozhanguva/Intrinsic_robustness_label_uncertainty | 3 | 12788262 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class Normalize(nn.Module):
def __init__(self, mu, std):
super(Normalize, self).__init__()
se... | 2.421875 | 2 |
explainaboard/tasks/re/eval_spec.py | Shadowlized/ExplainaBoard | 255 | 12788263 | # -*- coding: utf-8 -*-
import explainaboard.error_analysis as ea
import numpy
import os
def get_aspect_value(sample_list, dict_aspect_func):
dict_span2aspect_val = {}
dict_span2aspect_val_pred = {}
for aspect, fun in dict_aspect_func.items():
dict_span2aspect_val[aspect] = {}
dict_span2a... | 2.65625 | 3 |
tests/test_query_runner.py | o19s/solr-grid-tuning | 0 | 12788264 | <filename>tests/test_query_runner.py<gh_stars>0
from solr_grid_tuning.solr_client import SolrClient
from solr_grid_tuning.solr_query import SolrQuery
from solr_grid_tuning.query_runner import QueryRunner
# This is the configuration of the local Solr instance that is assumed by this test
base_url = "http://localhost:89... | 2.34375 | 2 |
old_backup/seattle.py | GabbyHE/Bigscity-LibCity-Datasets | 32 | 12788265 | <filename>old_backup/seattle.py
# link: https://www.microsoft.com/en-us/research/publication/hidden-markov-map-matching-noise-sparseness/
import re
import os
import json
from util import ensure_dir
network = trackInfo = truth = geo = rel = dyna = usr = route = None
def processGeoAndRelAndRoute():
geo.write("geo_i... | 2.265625 | 2 |
ThreadFixProApi/Applications/_utils/_cicd.py | denimgroup/threadfix-python-api | 1 | 12788266 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__copyright__ = "(C) 2019 Denim group"
__contributors__ = ["<NAME>"]
__status__ = "Production"
__license__ = "MIT"
from ...API import API
class CICDAPI(API):
def __init__(self, host, api_key, verify_ssl, timeout, headers, user_ag... | 2.3125 | 2 |
accounts/urls.py | 7h3qu1rkyb1t/Xarena | 0 | 12788267 | <gh_stars>0
from . import views
from django.urls import path
from django.contrib.auth import views as auth_views
urlpatterns = [
path("", views.target),
path("register/", views.register, name="register"),
path("login/", auth_views.LoginView.as_view(template_name = "accounts/login.html"), name="login"),
... | 1.9375 | 2 |
job_configs.py | rajeswar18/url_benchmark | 0 | 12788268 | <filename>job_configs.py
import os
if os.environ["EAI_ACCOUNT_ID"] == "<KEY>":
user = "pau"
elif os.environ["EAI_ACCOUNT_ID"] == "68fdc833-1eaa-4b60-9b64-ac27814e4b61":
user = "sai"
else:
user = "issam"
JOB_CONFIG = {
"account_id": os.environ["EAI_ACCOUNT_ID"],
"image": "registry.console.elementai... | 1.75 | 2 |
analysis/HtmlAnalysis.py | matthewcornell/skeptical-toolbox | 0 | 12788269 | <reponame>matthewcornell/skeptical-toolbox<gh_stars>0
import urllib.request
import urllib.parse
from bs4 import BeautifulSoup as bs
class HtmlAnalysis(object):
"""
Defines routines to analyze a URL and extract various resources to support a skeptical analysis of it.
"""
def __init__(self, url, html=... | 3.09375 | 3 |
libs/chromosome/mutation_service.py | Hunteerq/GeneticAlgorithms | 0 | 12788270 | import numpy as np
from libs.chromosome.chromosome_modifier import ChromosomeModifier
from libs.chromosome.mutation_types import MutationTypes
class MutationService:
def __init__(self, algorithm_configuration):
self.__algorithm_configuration = algorithm_configuration
self.__chromosome_modifier =... | 2.671875 | 3 |
cakebot/bot.py | jeffseif/cakebot | 0 | 12788271 | <gh_stars>0
import inspect
import irc.bot
import irc.connection
import re
import ssl
import cakebot.bind
import cakebot.config
import cakebot.logging
import cakebot.mods
from cakebot import __version__
from cakebot import KILL_SWITCH
class Bot(irc.bot.SingleServerIRCBot):
nick_to_kill = None
def reset_attr... | 2.09375 | 2 |
tests/conftest.py | federicober/cookiecutter-python-lib | 1 | 12788272 | import contextlib
import os
import pathlib
import shutil
import subprocess
import sys
import pytest
from cookiecutter.main import cookiecutter
_template_dir = pathlib.Path(__file__).parent.parent
_base_cookiecutter_args = {
"project_name": "my-python-package",
"package_name": "my_python_package",
"friendl... | 2.0625 | 2 |
dihedrals.py | meyresearch/ANI-Peptides | 1 | 12788273 | <reponame>meyresearch/ANI-Peptides
# Based on: http://archive.ambermd.org/201304/0256.html
# https://github.com/fylinhub/2D-free-energy-plots-and-similarity-calculation/blob/master/plot_freeenergy_chi1chi2.ipynb
# import MDAnalysis as mda
# from MDAnalysis.analysis.dihedrals import Ramachandran
import mdtraj as md
imp... | 2.203125 | 2 |
DATA_PROCESS/tiy_test.py | realmiya/scentsearcher | 0 | 12788274 | import pandas as pd
import numpy as np
import re
import math
import sys
def top_extract(s):
top = []
for i in range (1,len(s)+1):
if s[i-1].lower() == 'top':
top.append(s[i])
return top
def base_extract(s):
base = []
for i in range (1,len(s)+1):
if s[i-1].lower() == '... | 2.828125 | 3 |
calipso/tools/tooltip.py | NASA-DEVELOP/vocal | 18 | 12788275 | ######################################
# tooltip.py
# @author: <NAME>
# 6/24/2015
######################################
from Tkinter import Toplevel, TclError, Label, LEFT, SOLID
class ToolTip(object):
"""
Displays text in a label below a passed widget
:param widget: The widget tooltip will be ... | 3.625 | 4 |
external/kit_sch_ge/config.py | sjeknic/CellST | 0 | 12788276 | from pathlib import Path
def get_project_path():
return Path(__file__).parent
def get_data_path():
project_path = get_project_path()
parent_dir = project_path.parent
return parent_dir / 'data'
def get_results_path():
project_path = get_project_path()
parent_dir = project_path.parent
re... | 2.84375 | 3 |
models/two_d/alexnet.py | lykzsm/Pytorch-Medical-Classification | 37 | 12788277 | <reponame>lykzsm/Pytorch-Medical-Classification
import torch.nn as nn
import torch.nn.functional as F
import torch
class AlexNet(nn.Module):
def __init__(self, num_classes=1000):
super(AlexNet, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(1, 64, kernel_size=11, stride=4, p... | 3 | 3 |
pdlearn/feature_selection/variance_threshold.py | lewisacidic/pandas-learn | 1 | 12788278 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of pandas-learn
# https://github.com/RichLewis42/pandas-learn
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT
# Copyright (c) 2015, <NAME> <<EMAIL>>
"""
pdlearn.feature_selection.variance_threshold
~~~~~~~~~~~~~~~~~~~~~~~... | 3.09375 | 3 |
Conditional Statements/If.py | Adi-19/Python | 0 | 12788279 | <filename>Conditional Statements/If.py<gh_stars>0
# WAP to show the use of If statment
phone_balance = int(input("enter the balence"))
bank_balance = 100
print(phone_balance, bank_balance)
if phone_balance < 5:
phone_balance += 10
bank_balance -= 10
print(phone_balance, bank_balance)
#the lines ... | 3.9375 | 4 |
pystorm/hal/neuromorph/graph/graph_object.py | Stanford-BIS/pystorm | 3 | 12788280 | from abc import ABC, abstractmethod
# GraphObject-specific exceptions
class GraphObjectError(Exception):
"""Base class for GraphObject Exceptions"""
name = "graph_object.py"
class ConnectionTypeError(GraphObjectError):
"""Exception to raise when connected GraphObject types are incompatible"""
def __in... | 3.328125 | 3 |
Python/questions/BinaryTreePreorderTraversal/binary-tree-preorder-traversal-solution-2.py | udcymen/leetcode | 0 | 12788281 | <gh_stars>0
class TreeNode:
def __init__(self, val:int = 0, left:'TreeNode' = None, right:'TreeNode' = None):
self.val = val
self.left = left
self.right = right
# Solution 2: Iterative
def preorderTraversal(root: TreeNode) -> list[int]:
result = []
if not root:
ret... | 3.859375 | 4 |
module/invite.py | lolotree11/pyscord | 14 | 12788282 | <filename>module/invite.py<gh_stars>10-100
import channels
import client
import general
import guild
import invite
import listener
import messages
import user
class Invite:
def __init__(self, invite, basic_header, api_version=9):
self.basic_header = basic_header
self.api_version = api_version
... | 2.3125 | 2 |
flex/ussd/screens/metadata.py | centergy/flex_ussd | 0 | 12788283 | <reponame>centergy/flex_ussd
import re
from flex.utils import text
from flex.utils.void import Void
from flex.utils.decorators import export
from flex.utils.metadata import BaseMetadata, metafield, get_metadata_class
from .. import exc
from ..namespaces import module_ussd_namespace, isvalid_namespace_name
__all__ = [... | 2.0625 | 2 |
tests/test_router.py | Bilonan/django-binder | 14 | 12788284 | <reponame>Bilonan/django-binder
from django.test import TestCase
from binder.exceptions import BinderNotFound
from binder.json import jsondumps
from binder.models import BinderModel
from binder.router import Router, Route, detail_route
from binder.views import ModelView
from django.urls.base import is_valid_path, cle... | 2.234375 | 2 |
passenger_wsgi.py | gijzelaerr/workflow-service | 32 | 12788285 | <filename>passenger_wsgi.py
from wes_service.wes_service_main import setup
application = setup()
| 0.957031 | 1 |
examples/helloworld.py | JettHu/mongo-orm | 0 | 12788286 | <reponame>JettHu/mongo-orm
from mongo_orm import Model
from mongo_orm import StringField
from mongo_orm import CommonField
class User(Model):
name = StringField('user_name', type_check=True)
test_field = CommonField('test', default=-9999)
| 2.1875 | 2 |
checks_available/check_solr.py | oddeyeco/oe-agent3 | 5 | 12788287 | <reponame>oddeyeco/oe-agent3
import lib.record_rate
import lib.puylogger
import lib.record_rate
import lib.getconfig
import lib.commonclient
import lib.basecheck
import json
solr_url = lib.getconfig.getparam('Solr', 'stats')
check_type = 'solr'
class Check(lib.basecheck.CheckBase):
def precheck(self):
... | 2.078125 | 2 |
2020/day/16/tickets.py | mboos/advent-of-code | 0 | 12788288 | <gh_stars>0
# Lint as: python3
"""
Solution to https://adventofcode.com/2020/day/16
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
from absl import flags
from dataclasses import dataclass
import re
FLAGS = flags.FLAGS
flags.DEFINE... | 2.875 | 3 |
boa-nimbus/lambda/UserUpdateHandlerFunction/index.py | moduspwnens/boa-chat | 12 | 12788289 | <filename>boa-nimbus/lambda/UserUpdateHandlerFunction/index.py<gh_stars>10-100
"""UserUpdateHandlerFunction
Updates a user's profile attributes.
"""
from __future__ import print_function
import os
import json
import boto3
import botocore
from apigateway_helpers.exception import APIGatewayException
from apigateway_h... | 2.328125 | 2 |
listings/middleware.py | darkismus/kompassi | 13 | 12788290 | <gh_stars>10-100
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
class ListingsMiddleware(MiddlewareMixin):
def process_request(self, request):
hostname = request.META['HTTP_HOST']
if hostname in settings.KOMPASSI_LISTING_URLCONFS:
request.urlconf... | 1.828125 | 2 |
attic/shell/cmds/token.py | glycerine/pyg | 76 | 12788291 | # Copyright 2011 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import sh
def token(*args):
for arg in args:
print "%s -> %s" % (arg, sh.tokenise(arg))
| 2.484375 | 2 |
src/verifier.py | athalonis/CCL-Verification-Environment | 2 | 12788292 | #!/usr/bin/env python
#Copyright (c) 2014, <NAME> <<EMAIL>>
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
#* Redistributions of source code must retain the above copyright notice, this
# list of... | 1.695313 | 2 |
archive/2016/week3/homework/xor.py | YAtOff/python0 | 6 | 12788293 | <filename>archive/2016/week3/homework/xor.py
"""
Дефинирайте функцията `xor` (изключващо ИЛИ), която има следната таблица на
истинност:
+----------------------+
|Input |Output|
+-------+-------+------|
|A |B | |
+-------+-------+------|
|False |False |False |
+-------+-------+------|
|False ... | 3.828125 | 4 |
testing/vcsaddons/test_vcs_addons_pcoords.py | xylar/cdat | 62 | 12788294 |
import sys,os
data = sys.argv[1]
src = sys.argv[2]
import vcs.testing.regression as regression
import vcs
import vcsaddons, numpy
import cdms2
f = cdms2.open(data)
rms_xyt = f("rms_xyt")
ax1 = cdms2.createAxis(['0071-0100' ,'ACCESS1-0' ,'ACCESS1-3' ,'CCSM4' ,'CESM1-BGC' ,'CESM1-CAM5',
'CESM1-FASTCHEM' ,'CESM1-W... | 2.03125 | 2 |
SST_doppler.py | CyclingNinja/SST_doppler_calc | 0 | 12788295 | <filename>SST_doppler.py
from __future__ import print_function, division
from sunkitsst.read_cubes import read_cubes
import matplotlib.pyplot as plt
import numpy as np
from astropy.modeling import models, fitting
from scipy.optimize import minimize
#from scipy.signal import argrelextrema
from scipy.special impor... | 2.375 | 2 |
pyrobolearn/control/pid.py | Pandinosaurus/pyrobolearn | 2 | 12788296 | <filename>pyrobolearn/control/pid.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This defines the PID controller
class PID(object):
r"""Proportional-Integral-Derivative Controller
The PID control scheme is given by:
.. math: u(t) = K_p e(t) + K_i \int_0^t e(\tau) d\tau + K_d \frac{d e(... | 3.25 | 3 |
tests/test_class6.py | kinther/ansible_course | 14 | 12788297 | import re
import pytest
from pathlib import Path
from utilities import subprocess_runner, remove_ansible_warnings
TEST_CASES = [
"../class6/collateral/roles_test/test_pb1.yml",
"../class6/collateral/roles_test/test_pb2.yml",
"../class6/collateral/roles_test/test_pb3.yml",
"../class6/collateral/roles_te... | 2.109375 | 2 |
pyop4/opbase/__init__.py | cindy0123/duty-util01 | 0 | 12788298 | #
from opmsg import opmsg
from opfilehandle import iterfind, is_writeable, is_readable, tailf, filetail, myreadline, md5sum
from pypyscreen import getoutput, getstderr
from openv import op4env
from opErrCtl import opErrCtl
from opgit import basegit
from opfileformat import opfileformat
from opconfig import opco... | 1.390625 | 1 |
myshop/cart/cart.py | Devenc234/balajiemitra | 0 | 12788299 | from decimal import Decimal
from django.conf import settings
from shop.models import Product
from coupons.models import Coupon
class Cart(object):
def __init__(self, request):
"""
Initialize the cart
:param request:
"""
self.session = request.session
cart = self.s... | 2.640625 | 3 |
huxley/core/migrations/0043_auto_20200820_1401.py | bmun/huxley | 18 | 12788300 | # Generated by Django 2.2.6 on 2020-08-20 14:01
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('core', '0042_conference_treasurer'),
]
operations = [
migrations.AddField(
model_name='conference',... | 1.640625 | 2 |
nodenet/python/nodenet/variables/nodenet.py | NOOXY-research/NodeNet | 2 | 12788301 | <filename>nodenet/python/nodenet/variables/nodenet.py
# nodenet/variables/nodenet.py
# Description:
# "nodenet.py" provideinformation of current version of nodenet.
# Copyright 2018 NOOXY. All Rights Reserved.
nodenet = {
'Version' : 'NodeNetPy 0.0.0',
'Author' : [
'<NAME>',
],
'Company' : 'NOOXY in... | 1.296875 | 1 |
hypha/apply/review/options.py | killapop/hypha | 20 | 12788302 | from django.utils.translation import gettext as _
NA = 99
RATE_CHOICES = (
(0, _('0. Need more info')),
(1, _('1. Poor')),
(2, _('2. Not so good')),
(3, _('3. Is o.k.')),
(4, _('4. Good')),
(5, _('5. Excellent')),
(NA, _('n/a - choose not to answer')),
)
RATE_CHOICES_DICT = dict(RATE_CHOI... | 2.171875 | 2 |
src/clustering.py | krishnaShreedhar/Compositional-embedding-for-speaker-diarization | 0 | 12788303 | """
Simple audio clustering
1. Get the embeddings - at an interval of 0.5s each
2. Get the VAD - variable interval
3. Get embeddings for a VAD interval -> Take average of the embeddings
4. Get the ground truth for embedding for each speaker - marked 0.5s interval
5. L2 Normalize the embeddings before taking a distance ... | 3.25 | 3 |
day4/lambda.py | lilbond/bitis | 0 | 12788304 | <filename>day4/lambda.py<gh_stars>0
def greeting():
return "Hello"
print(greeting())
greet = lambda : "Hello"
print(greet())
# take arguments
strip_and_upper_case = lambda s: s.strip().upper()
strip_and_upper_case(" Hello ")
# take arbitrary number of arguments / keyword arguments
greeting = lambda x... | 3.5625 | 4 |
code/python/pymir/analytics/riffstation/mayor_minor_chords.py | mfranco/pymir | 1 | 12788305 | <reponame>mfranco/pymir<filename>code/python/pymir/analytics/riffstation/mayor_minor_chords.py<gh_stars>1-10
"""
How many majors and minor chords are in all songs
"""
from pymir import settings
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
def compute(db):
mayor_minor = []
... | 2.890625 | 3 |
app_test/ruuvi_app.py | jutako/ble-gateway | 2 | 12788306 | <gh_stars>1-10
from ruuvitag_sensor.ruuvi import RuuviTagSensor
# List of macs of sensors which data will be collected
# If list is empty, data will be collected for all found sensors
tag1 = 'C3:60:95:50:C6:0E'
def handle_data(found_data):
print('MAC ' + found_data[0])
print(found_data[1])
macs = [tag1]
Ru... | 2.859375 | 3 |
easy_food/core/views.py | nahidsaikat/EasyFood-Web | 0 | 12788307 | <reponame>nahidsaikat/EasyFood-Web
"""Route declaration."""
from flask import (
Blueprint,
url_for,
render_template,
redirect,
make_response,
request,
session
)
from flask_login import current_user, login_required
from datetime import datetime as dt
from easy_food import db
from .forms impo... | 2.765625 | 3 |
debpackager/packages/conf/configurations.py | urban48/debpackager | 66 | 12788308 | <filename>debpackager/packages/conf/configurations.py
PACKAGE_ROOT = 'debian'
VERSION_REGEX = r'^v(\d\.\d\.\d$)'
STARTING_VERSION = '0.0.0'
VIRTUAL_ENV_PATH = 've'
| 1.359375 | 1 |
page/migrations/0002_content.py | kthaisse/website | 1 | 12788309 | # Generated by Django 2.2.10 on 2020-11-04 21:03
from django.db import migrations, models
import versatileimagefield.fields
class Migration(migrations.Migration):
dependencies = [("page", "0001_initial")]
operations = [
migrations.AddField(
model_name="page", name="in_menu", field=model... | 1.703125 | 2 |
main.py | iiithf/ias-device | 0 | 12788310 | <reponame>iiithf/ias-device
def parse_addr(addr):
i = addr.find(':')
host = '' if i<0 else addr[0:i]
port = int(addr if i<0 else addr[i+1:])
return (host, port)
class RequestHandler(BaseHTTPRequestHandler):
def body(self):
size = int(self.headers.get('Content-Length'))
return self.rfile.read(size)... | 2.453125 | 2 |
valipede/jsonschema.py | cooper-software/valipede | 0 | 12788311 | <gh_stars>0
from . import fields
try:
basestring
except NameError:
basestring = str
class JSONSchemaSerializer(object):
fallbacks = (
fields.Text, fields.Integer, fields.Float, fields.DateTime,
fields.Boolean, fields.Enum, fields.ListOf, fields.OneOf,
fields.Compound, fields.Anything
)
def serializ... | 2.421875 | 2 |
src/reports/migrations/0010_auto_20200701_1021.py | smsolima/report | 0 | 12788312 | <reponame>smsolima/report
# Generated by Django 3.0.7 on 2020-07-01 08:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('reports', '0009_auto_20200701_0957'),
]
operations = [
migrations.RemoveField(
... | 1.578125 | 2 |
app/engine/from_db/utils.py | publichealthengland/coronavirus-dashboard-api-v2-server | 51 | 12788313 | <reponame>publichealthengland/coronavirus-dashboard-api-v2-server<gh_stars>10-100
#!/usr/bin python3
# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python:
from typing import Dict, Iterable
from tempfile import NamedTemporaryFile
from asyncio import Lock
# 3rd p... | 2.015625 | 2 |
genrl/deep/agents/ddpg/ddpg.py | infinitemugen/genrl | 0 | 12788314 | <gh_stars>0
import numpy as np
import torch
import torch.nn as nn
import torch.optim as opt
import gym
from copy import deepcopy
from ...common import (
ReplayBuffer,
get_model,
save_params,
load_params,
get_env_properties,
set_seeds,
venv,
)
from typing import Optional, Any, Tuple, Union, ... | 2.171875 | 2 |
distributions/non_parametric.py | kitteltom/probabilistic-energy-forecasting | 2 | 12788315 | import numpy as np
from distributions.distribution import Distribution
class NonParametric(Distribution):
"""
Provides functions for a non-parametric forecast distribution.
"""
@staticmethod
def pdf(x, pdf_x, x_eval):
pass
@staticmethod
def cdf(x, cdf_x, x_eval):
"""
... | 3.609375 | 4 |
examples/variational_autoencoder/variational_autoencoder_deconv_horovod.py | avolkov1/keras_experiments | 92 | 12788316 | <reponame>avolkov1/keras_experiments
'''This script demonstrates how to build a variational autoencoder
with Keras and deconvolution layers.
Reference: "Auto-Encoding Variational Bayes" https://arxiv.org/abs/1312.6114
Using Horovod.
original implementation:
https://github.com/fchollet/keras/blob/master/examples/vari... | 2.703125 | 3 |
smallprox/core.py | alairock/small-prox | 17 | 12788317 | <filename>smallprox/core.py
import asyncio
import os
import logging
import re
import dns.resolver
logging.basicConfig()
from .server import HTTPServer
from .mapper import update_config, add_container
logger = logging.getLogger('small-prox')
NO_HTTPS_REDIRECT = os.getenv('NO_HTTPS_REDIRECT', 'false').lower() == 'tru... | 2.125 | 2 |
task22.py | kazh98/pe2019 | 0 | 12788318 | <reponame>kazh98/pe2019
import math
class Triangle(object):
def __init__(self, a, b, C):
self.a = a
self.b = b
self.C = C * math.pi / 180
def getHeight(self):
return self.b * math.sin(self.C)
def getArea(self):
return (self.a * self.getHeight()) / 2
def g... | 3.828125 | 4 |
utilities/execute_sql.py | Nunie123/transom | 0 | 12788319 | <filename>utilities/execute_sql.py<gh_stars>0
import sqlalchemy as sa
def execute_sql_string(connection_manager, raw_sql_string):
'''
This function can execute multiple SQL statements.
The output is a list of a list of tuples. e.g. [ [ (one, two), (three, four) ], [ (1,2), (3,4) ] ]
The first tuple ... | 3.328125 | 3 |
src/sentry/snuba/sessions.py | pierredup/sentry | 0 | 12788320 | <reponame>pierredup/sentry
from __future__ import absolute_import
import pytz
from datetime import datetime, timedelta
from sentry.utils.snuba import raw_query, parse_snuba_datetime
from sentry.utils.dates import to_timestamp, to_datetime
from sentry.snuba.dataset import Dataset
DATASET_BUCKET = 3600
def _convert... | 2.484375 | 2 |
nanome_matryx/menus/CreationsMenu.py | nanome-ai/plugin-matryx | 0 | 12788321 | <filename>nanome_matryx/menus/CreationsMenu.py<gh_stars>0
from functools import partial
import nanome
import utils
from nanome.util import Logs
class CreationsMenu():
def __init__(self, plugin, fth_menu, on_close):
self._plugin = plugin
menu = nanome.ui.Menu.io.from_json('menus/json/my_creations.... | 2.078125 | 2 |
self-learning/based/00000023.py | vladspirin/python-learning | 1 | 12788322 | # from collections import ChainMap
# food_types = {'Vegetables': 15, 'Dairy': 20, 'Meat': 3, 'Cereals': 9, 'Fruits': 11, 'Fish': 7}
# countries = {'USA': 25, 'Australia': 15, 'Canada': 15, 'France': 6, 'India': 4}
# discount = {'gold': 20, 'regular': 10}
# chain = ChainMap(food_types, countries)
# food_types['Sweets'... | 3.421875 | 3 |
flask/test/patches.py | spaudanjo/boxtribute | 0 | 12788323 | from functools import wraps
from unittest.mock import patch
from auth import get_user_token_string
def mock_decorator(f):
"""Fake decorator for mocking other decorators."""
@wraps(f)
def decorated_function(*args, **kwargs):
return f(*args, **kwargs)
return decorated_function
def mock_auth... | 2.90625 | 3 |
vnpy/api/lhang/__init__.py | firekay/vnpy | 5 | 12788324 | # encoding: UTF-8
from vnlhang import LhangApi | 0.960938 | 1 |
python/fuzzy_classification/classifiers/RandomFuzzyTree.old.py | oljubuncic1/fuzzy-classification | 0 | 12788325 | import numpy as np
from math import log, sqrt, ceil
import random
import string
from copy import copy
import pyximport
from tabulate import tabulate
pyximport.install()
from ..util import math_functions
import matplotlib.pyplot as plt
import textwrap
from textwrap import dedent
from multiprocessing import Pool
from ... | 2.09375 | 2 |
uri/1040_media_3.py | thekilian/Python-pratica | 0 | 12788326 | '''
Leia quatro números (N1, N2, N3, N4), cada um deles com uma casa decimal, correspondente às quatro notas de um aluno. Calcule a média com pesos 2, 3, 4 e 1, respectivamente, para cada uma destas notas e mostre esta média acompanhada pela mensagem "Media: ". Se esta média for maior ou igual a 7.0, imprima a mensagem... | 3.4375 | 3 |
ctrl/user_ctrl.py | k4t0mono/hashtag_analysis | 0 | 12788327 | <reponame>k4t0mono/hashtag_analysis
from models import User
from get_tweets import session, logger
class User_Ctrl():
def new_user(self, user_):
return User(
id=user_.id,
screen_name=user_.screen_name,
created_at=user_.created_at,
)
def add_user(self, user... | 2.578125 | 3 |
reader/management/commands/train_data.py | AymaneZizi/dailyreader | 0 | 12788328 | from reader.models import *
from django.core.management.base import BaseCommand, CommandError
import os
from topia.termextract import extract
import naive_bayes_classifier
from constants.app_constants import *
def get_pcategory(category_name,pcategory_objects):
other_category = None
category = None
for el... | 2.1875 | 2 |
Preprocessing Scripts/createS-4Split.py | Zero-Shot/Zero-Shot-Learning | 24 | 12788329 | <reponame>Zero-Shot/Zero-Shot-Learning
import csv
import sys
import warnings
import numpy as np
def get_number_of_words(txt_file):
with open(txt_file) as file:
return sum(1 for _ in file)
def get_number_of_columns(csv_file):
with open(csv_file) as file:
reader = csv.reader(file, delimiter='... | 3.140625 | 3 |
utils.py | Li357/instrument-classifier | 0 | 12788330 | <gh_stars>0
from math import ceil
def print_progressbar(progress, msg=''):
print('\r{0}: [{1:50s}] {2:.1f}%'.format(msg, '#' * int(ceil(progress * 50)), progress * 100),
end='',
flush=True)
| 2.78125 | 3 |
py/soa/token.py | tslnc04/soa | 0 | 12788331 | <reponame>tslnc04/soa
"""
Copyright 2017 <NAME>
token.py contains the code for token types and some basic character tests
"""
ERROR = 0
EOF = 1
EOL = 2
REGISTER = 3
INT = 4
SET = 5
OUT = 6
ADD = 7
EXIT = 8
IF = 9
FI = 10
TOKEN_NAMES = [
"error",
"eof",
"eol",
"register",
"int",
"set",
"... | 3.078125 | 3 |
examples/wsecho.py | VladimirKuzmin/werkzeug | 4,200 | 12788332 | <reponame>VladimirKuzmin/werkzeug
"""Shows how you can implement a simple WebSocket echo server using the
wsproto library.
"""
from werkzeug.exceptions import InternalServerError
from werkzeug.serving import run_simple
from werkzeug.wrappers import Request
from werkzeug.wrappers import Response
from wsproto import Conn... | 2.734375 | 3 |
scripts/mkdiff.py | charlie45000/corunners-example | 0 | 12788333 | #! /usr/bin/env python3
import argparse
from pathlib import Path
import json
import sys
from scriptutil import calc
C0_OFF = "Task: C0, Corunner: OFF"
C0_ON = "Task: C0, Corunner: ON"
C1_OFF = "Task: C1, Corunner: OFF"
C1_ON = "Task: C1, Corunner: ON"
def getopts(argv):
parser = argparse.ArgumentParser()
pa... | 2.46875 | 2 |
backend/eaws/ergonomics_struct.py | ramp-eu/Pose_Recognition_Correction | 0 | 12788334 | <gh_stars>0
import time
ergonomics_template = {
'body_angle': {
'type': 'Float'
},
'upper_limbs_angle': {
'type': 'Float'
},
'lower_limbs_angle': {
'type': 'Float'
},
'pose_1': {
'type': 'Float'
},
'pose_3': {
'type': 'Float'
},
'pose_... | 1.820313 | 2 |
tools/coverage_merge/merge.py | edcote/fc4sc | 30 | 12788335 | <reponame>edcote/fc4sc
"""
/******************************************************************************
Copyright 2003-2018 AMIQ Consulting s.r.l.
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 th... | 1.492188 | 1 |
setup.py | alella/browserhist | 1 | 12788336 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name="browserhist",
version="0.4.1",
author="<NAME>",
packages=find_packages(),
install_requires=[
"elasticsearch",
"python-dateutil",
"click",
"coloredlogs"
],
entry_points={
'cons... | 1.429688 | 1 |
python--exercicios/ex053.py | Eliezer2000/python | 0 | 12788337 | <reponame>Eliezer2000/python<filename>python--exercicios/ex053.py
frase = str(input('Digie uma frase : ')).strip().upper()
palavras = frase.split()
junto = ''.join(palavras)
print('Você digitou a frase {}'.format(junto))
inverso = ''
for letra in range(len(junto) - 1, - 1, - 1):
inverso += junto[letra]
if inverso ==... | 4.1875 | 4 |
utils/job_db.py | yutiansut/cilantro | 0 | 12788338 | <gh_stars>0
import os
import datetime
from pymongo import MongoClient, DESCENDING, ReturnDocument
class JobDb:
job_db_url = os.environ['JOB_DB_URL']
job_db_port = int(os.environ['JOB_DB_PORT'])
job_db_name = os.environ['JOB_DB_NAME']
first_object_id = int(os.environ['FIRST_OBJECT_ID'])
def __in... | 2.875 | 3 |
reference/Python/lang/*and**_in_function.py | steadylearner/code | 4 | 12788339 | def print_some(a, b):
print(a, b)
list_of_numbers = [1, 2]
print_some(*list_of_numbers)
# a = {'a': "one", 'b': "two", 'c': "three" }]
# print_some(*a) key
# print_some(**a) value
| 3.578125 | 4 |
src/genie/libs/parser/iosxe/tests/ShowPlatformHardwareQfpActiveFeatureAppqoe/cli/equal/175_golden_output_expected.py | balmasea/genieparser | 0 | 12788340 | expected_output = {
"feature":{
"appqoe":{
"global":{
"ip_non_tcp_pkts":9485,
"not_enabled":0,
"cft_handle_pkt":0,
"sdvt_divert_req_fail":41,
"sn_data_pkts_processed":0,
"sdvt_global_stats":{
... | 1.25 | 1 |
pyExSi/__init__.py | ladisk/pyExSi | 3 | 12788341 | __version__ = '0.42'
from .signals import *
| 1.054688 | 1 |
playwright/event_context_manager.py | tumregels/playwright-python | 2 | 12788342 | <reponame>tumregels/playwright-python
# Copyright (c) Microsoft 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 required... | 2.328125 | 2 |
keras_based/exchange/multi_ex_ui.py | TianyuDu/AnnEconForecast | 7 | 12788343 | """
Multivariate Version of exchange prediciton.
"""
import os
os.system("clear")
import sys
sys.path.append("./core/containers/")
sys.path.append("./core/models/")
sys.path.append("./core/tools/")
import datetime
import keras
import pandas as pd
import numpy as np
import matplotlib
# TODO: add auto-detect
# for mac O... | 2.609375 | 3 |
examples/BioASQ/extra_modules/bioasq/KMeansOrderer.py | paritoshgpt1/BOOM | 29 | 12788344 | <reponame>paritoshgpt1/BOOM
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from .SentenceOrderer import SentenceOrderer
import re, sys
import numpy as np
class KMeansOrderer(SentenceOrderer):
def __init__(self):
pass
def setup(self, sentences, snippets=None, k=2, max_iter=10, max_toke... | 2.59375 | 3 |
scripts/lexicons.py | opener-project/opinion_miner_deluxe | 1 | 12788345 | <reponame>opener-project/opinion_miner_deluxe
#!/usr/bin/env python
import sys
import os
import csv
from subprocess import Popen,PIPE
def create_lexicons(path_to_script, training_file,exp_filename, tar_filename):
cmd = ['python']
cmd.append(path_to_script)
cmd.append('-exp_csv')
cmd.append(exp_filenam... | 2.109375 | 2 |
tests/examples/test_pandas_operations.py | BBVA/python-etl | 20 | 12788346 | <reponame>BBVA/python-etl
# Copyright 2017 BBVA
#
# 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 agr... | 2.515625 | 3 |
fmojinja/chpi/__main__.py | Taro-Imahiro/fmojinja | 0 | 12788347 | <reponame>Taro-Imahiro/fmojinja<filename>fmojinja/chpi/__main__.py<gh_stars>0
from ..mixin import SubCommands
from .vpi import Vpi
from .input import Input
SubCommands.main_proc({
"vpi": Vpi,
"input": Input,
})
| 1.34375 | 1 |
spider/douban.py | yhfyhf/wang_fm | 30 | 12788348 | <reponame>yhfyhf/wang_fm
#!/usr/bin/env python
# encoding: utf-8
'''
Ref:
https://github.com/zonyitoo/doubanfm-qt/wiki/%E8%B1%86%E7%93%A3FM-API
'''
import json
import random
import traceback
import requests
import requests.exceptions
from model.channel import get_channel, add_channel, update_channel
from model.music im... | 2.3125 | 2 |
books/grokking_deeplearning/ch3/numpy_dables.py | gerritjvv/deeplearning | 0 | 12788349 | import numpy as np
a = np.array([
[1, 2, 3],
[4, 5, 6]
])
print("print(a)")
print(a)
print()
print("print(a.T)")
print(a.T)
print()
print("print(a.dot(2))")
print(a.dot(2))
print()
print("print(a.dot(np.array([2, 2, 2])))")
print(a.dot(np.array([2, 2, 2])))
print()
| 3.390625 | 3 |
main.py | glombard/python-plugin-experiment | 0 | 12788350 | """
Sample Python 3.5 application that has plugin support.
It dynamically loads plugins from the 'plugins' directory.
Two types of plugins are supported: commands and hooks.
A command is executed if it matches a cmdline argument.
A hook is executed before and after each command...
Example usage:
main.py print upp... | 3.390625 | 3 |