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 |
|---|---|---|---|---|---|---|
tests/explainers/test_explainer.py | zduey/shap | 1 | 16100 | <filename>tests/explainers/test_explainer.py
""" Tests for Explainer class.
"""
import pytest
import shap
def test_wrapping_for_text_to_text_teacher_forcing_logits_model():
""" This tests using the Explainer class to auto choose a text to text setup.
"""
transformers = pytest.importorskip("transformers"... | 2.53125 | 3 |
main/urls.py | guinslym/django-Django-Code-Review-CodeEntrepreneurs | 2 | 16101 | <filename>main/urls.py
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.conf.urls.static import static
from django.conf.urls.i18n import i18n_patterns
from django.views.decorators.cache import cache_page
from django.conf.urls import url, include, handler404, handler... | 1.914063 | 2 |
examples/simpleform/app/forms.py | ezeev/Flask-AppBuilder | 71 | 16102 | <reponame>ezeev/Flask-AppBuilder
from wtforms import Form, StringField
from wtforms.validators import DataRequired
from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
from flask_appbuilder.forms import DynamicForm
class MyForm(DynamicForm):
field1 = StringField(('Field1'),
description=('Your fiel... | 2.625 | 3 |
comms.py | kajusz/ufscreenadsclient | 0 | 16103 | <reponame>kajusz/ufscreenadsclient<filename>comms.py
import zmq
context = zmq.Context()
socket = context.socket(zmq.PAIR)
address = "tcp://127.0.0.1:5000"
def client(address):
socket.connect(address)
def server(address):
socket.bind(address)
def send(data):
socket.send_string(data)
def recv():
try:... | 2.5 | 2 |
runtime/python/Lib/site-packages/numpy/typing/tests/data/fail/datasource.py | hwaipy/InteractionFreeNode | 0 | 16104 | <filename>runtime/python/Lib/site-packages/numpy/typing/tests/data/fail/datasource.py<gh_stars>0
from pathlib import Path
import numpy as np
path: Path
d1: np.DataSource
d1.abspath(path) # E: incompatible type
d1.abspath(b"...") # E: incompatible type
d1.exists(path) # E: incompatible type
d1.exists(b".... | 2.0625 | 2 |
applications/admin/controllers/gae.py | otaviocarvalho/forca-inf | 1 | 16105 | ### this works on linux only
try:
import fcntl
import subprocess
import signal
import os
except:
session.flash='sorry, only on Unix systems'
redirect(URL(request.application,'default','site'))
forever=10**8
def kill():
p = cache.ram('gae_upload',lambda:None,forever)
if not p or p.poll... | 2.109375 | 2 |
basicts/archs/AGCRN_arch/AGCRNCell.py | zezhishao/GuanCang_BasicTS | 3 | 16106 | import torch
import torch.nn as nn
from basicts.archs.AGCRN_arch.AGCN import AVWGCN
class AGCRNCell(nn.Module):
def __init__(self, node_num, dim_in, dim_out, cheb_k, embed_dim):
super(AGCRNCell, self).__init__()
self.node_num = node_num
self.hidden_dim = dim_out
self.gate ... | 2.625 | 3 |
lib/python2.7/site-packages/openopt/kernel/iterPrint.py | wangyum/anaconda | 0 | 16107 | from numpy import log10, isnan
def signOfFeasible(p):
r = '-'
if p.isFeas(p.xk): r = '+'
return r
textOutputDict = {\
'objFunVal': lambda p: p.iterObjFunTextFormat % (-p.Fk if p.invertObjFunc else p.Fk),
'log10(maxResidual)': lambda p: '%0.2f' % log10(p.rk+1e-100),
'log10(MaxResidual/ConTol)':lambda p: '... | 2.421875 | 2 |
src/cli.py | blu3r4y/ccc-linz-mar2019 | 0 | 16108 | import os
from main import main
from pprint import pprint
def parse(lines):
# world bounds
wx = int(lines[0].split()[0])
wy = int(lines[0].split()[0])
# initial position
x = int(lines[1].split()[0])
y = int(lines[1].split()[1])
cmds = []
# command / step pair
it = iter(lines[2].... | 3.03125 | 3 |
card_utils/games/gin/ricky/utils.py | cdrappi/card_utils | 0 | 16109 | <reponame>cdrappi/card_utils
import itertools
from typing import List, Tuple
from card_utils import deck
from card_utils.deck.utils import (
rank_partition,
suit_partition,
ranks_to_sorted_values
)
from card_utils.games.gin.deal import new_game
def deal_new_game():
""" shuffle up and deal each player... | 2.828125 | 3 |
evennia/contrib/rpg/dice/tests.py | davidrideout/evennia | 0 | 16110 | <filename>evennia/contrib/rpg/dice/tests.py
"""
Testing of TestDice.
"""
from evennia.commands.default.tests import BaseEvenniaCommandTest
from mock import patch
from . import dice
@patch("evennia.contrib.rpg.dice.dice.randint", return_value=5)
class TestDice(BaseEvenniaCommandTest):
def test_roll_dice(self, mo... | 2.765625 | 3 |
ardour_tally_relay.py | Jajcus/ardour_tally_relay | 0 | 16111 | <filename>ardour_tally_relay.py
#!/usr/bin/python3
import argparse
import logging
import signal
import time
from logging import debug, error, info, warning
import pythonosc.osc_server
import pythonosc.udp_client
from pythonosc.dispatcher import Dispatcher
import hid
LOG_FORMAT = '%(message)s'
POLL_INTERVAL = 1
# S... | 2.203125 | 2 |
python second semester working scripts/electrode_fcn.py | pm2111/Heart-Defibrillation-Project | 0 | 16112 | import numpy as np
import matplotlib.pyplot as plt
import os
path = "/Users/petermarinov/msci project/electrode data/test data/data/"
filenames = []
for f in os.listdir(path):
if not f.startswith('.'):
filenames.append(f)
i=-12
data = np.genfromtxt(path + filenames[i])
V = np.zeros((200,20... | 2.28125 | 2 |
resources/lib/IMDbPY/bin/get_first_movie.py | bopopescu/ServerStatus | 1 | 16113 | <filename>resources/lib/IMDbPY/bin/get_first_movie.py<gh_stars>1-10
#!/usr/bin/env python
"""
get_first_movie.py
Usage: get_first_movie "movie title"
Search for the given title and print the best matching result.
"""
import sys
# Import the IMDbPY package.
try:
import imdb
except ImportError:
print 'You bad... | 3.203125 | 3 |
ID3.py | idiomatic/id3.py | 0 | 16114 | #!/usr/bin/env python
# -*- mode: python -*-
import re
import struct
import types
def items_in_order(dict, order=[]):
"""return all items of dict, but starting in the specified order."""
done = { }
items = [ ]
for key in order + dict.keys():
if not done.has_key(key) and dict.has_key(key):
... | 3.0625 | 3 |
workflow/pnmlpy/pmnl_model.py | SODALITE-EU/verification | 0 | 16115 | <reponame>SODALITE-EU/verification
from xml.dom import minidom
from xml.etree import ElementTree
from xml.etree.cElementTree import Element, SubElement, ElementTree, tostring
class PNMLModelGenerator:
def generate(self, tasks):
top = Element('pnml')
child = SubElement(top, 'net',
... | 2.796875 | 3 |
examples/truss/truss_01.py | ofgod2/Analisis-matricial-nusa-python | 92 | 16116 | <filename>examples/truss/truss_01.py
# -*- coding: utf-8 -*-
# ***********************************
# Author: <NAME>
# E-mail: <EMAIL>
# Blog: numython.github.io
# License: MIT License
# ***********************************
from nusa import *
"""
<NAME>. (2007). A first course in the finite element analysis.
E... | 2.59375 | 3 |
Profiles/Mahmoud Higazy/logistic_regression.py | AhmedHani/FCIS-Machine-Learning-2017 | 13 | 16117 | from data_reader.reader import CsvReader
from util import *
import numpy as np
import matplotlib.pyplot as plt
class LogisticRegression(object):
def __init__(self, learning_rate=0.01, epochs=50):
self.__epochs= epochs
self.__learning_rate = learning_rate
def fit(self, X, y):
self.w_ =... | 3.578125 | 4 |
wavefront_reader/reading/readobjfile.py | SimLeek/wavefront_reader | 0 | 16118 | from wavefront_reader.wavefront_classes.objfile import ObjFile
from .readface import read_face
def read_objfile(fname):
"""Takes .obj filename and return an ObjFile class."""
obj_file = ObjFile()
with open(fname) as f:
lines = f.read().splitlines()
if 'OBJ' not in lines[0]:
raise Valu... | 2.625 | 3 |
constants.py | Guedelho/snake-ai | 0 | 16119 | <reponame>Guedelho/snake-ai<filename>constants.py
# Directions
UP = 'UP'
DOWN = 'DOWN'
LEFT = 'LEFT'
RIGHT = 'RIGHT'
# Colors
RED = (255, 0, 0)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
WHITE = (255, 255, 255)
| 1.851563 | 2 |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/video_pipeline/utils.py | osoco/better-ways-of-thinking-about-software | 3 | 16120 | <filename>Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/video_pipeline/utils.py
"""
Utils for video_pipeline app.
"""
from django.conf import settings
from edx_rest_api_client.client import OAuthAPIClient
def create_video_pipeline_api_client(api_client_id, api_cli... | 2.28125 | 2 |
run.py | Galaxy-SynBioCAD/extractTaxonomy | 0 | 16121 | #!/usr/bin/env python3
"""
Created on March 18 2020
@author: <NAME>
@description: Extract the taxonomy ID from an SBML file
"""
import argparse
import tempfile
import os
import logging
import shutil
import docker
def main(inputfile, output):
"""Call the extractTaxonomy docker to return the JSON file
:param... | 2.375 | 2 |
tests/dataio_tests/test_import_data_filter_empty_directories.py | cdeitrick/Lolipop | 6 | 16122 | <gh_stars>1-10
from pathlib import Path
import pandas
from muller.dataio import import_tables
from loguru import logger
DATA_FOLDER = Path(__file__).parent.parent / "data"
def test_filter_empty_trajectories():
input_column_0 = ['genotype-1', 'genotype-2', 'genotype-3', 'genotype-4', 'genotype-5', 'genotype-6']
inp... | 2.328125 | 2 |
posthog/apps.py | adamb70/posthog | 0 | 16123 | import os
import sys
import posthoganalytics
from django.apps import AppConfig
from django.conf import settings
from posthog.utils import get_git_branch, get_git_commit, get_machine_id
from posthog.version import VERSION
class PostHogConfig(AppConfig):
name = "posthog"
verbose_name = "PostHog"
def read... | 1.882813 | 2 |
src/task_timer.py | dlb-rl/pulse-rl | 4 | 16124 | import os
import json
import time
from datetime import timedelta
class TaskTimer:
def __init__(self):
self.time_performance = {}
self.start_times = {}
def start(self, task):
self.start_times[task] = time.time()
print('--- [{}] Start "{}"'.format(time.ctime(self.start_times[ta... | 3.0625 | 3 |
bioshareX/api/views.py | amschaal/bioshare | 7 | 16125 | # Create your views here.
from django.core.urlresolvers import reverse
from django.http.response import JsonResponse, HttpResponse
from settings.settings import AUTHORIZED_KEYS_FILE, SITE_URL
from bioshareX.models import Share, SSHKey, MetaData, Tag
from bioshareX.forms import MetaDataForm, json_form_validate
from guar... | 1.742188 | 2 |
db_query.py | UiOHive/FinseDashboard | 0 | 16126 | import datetime
import os, sys
import pprint
import requests
from pandas.io.json import json_normalize
import pandas as pd
URL = 'https://wsn.latice.eu/api/query/v2/'
#URL = 'http://localhost:8000/wsn/api/query/v2/'
#TOKEN = os.getenv('WSN_TOKEN')
TOKEN = os.getenv('WSN_TOKEN')
path = os.getcwd()
def query(
limi... | 2.96875 | 3 |
src/olympia/reviews/tests/test_models.py | leplatrem/addons-server | 0 | 16127 | <gh_stars>0
from django.utils import translation
from olympia import amo
from olympia.amo.tests import TestCase, ESTestCase
from olympia.addons.models import Addon
from olympia.reviews import tasks
from olympia.reviews.models import (
check_spam, GroupedRating, Review, ReviewFlag, Spam)
from olympia.users.models i... | 2.0625 | 2 |
snpy/spline2/__init__.py | emirkmo/snpy | 6 | 16128 | <filename>snpy/spline2/__init__.py<gh_stars>1-10
''' Spline2.py: wrapper for B. Thijsse et al.'s hyper-spline routines.
Yet another spline interpolation routine. The problem: given a set of
experimental data with noise, find the spline with the optimal number of
knots.
Solution : They use the usual kind of routine... | 3.078125 | 3 |
halo_app/infra/cache.py | halo-framework/halo-app | 0 | 16129 | from __future__ import annotations
import elasticache_auto_discovery
from pymemcache.client.hash import HashClient
# elasticache settings
elasticache_config_endpoint = "your-elasticache-cluster-endpoint:port"
nodes = elasticache_auto_discovery.discover(elasticache_config_endpoint)
nodes = map(lambda x: (x[1], int(x[2... | 2.65625 | 3 |
uniclass_to_nf_ea_com_source/b_code/migrators/uniclass_raw_to_domain/evolve/evolve_stage_4/domain_table_data_processor/parent_code_column_adder.py | boro-alpha/uniclass_to_nf_ea_com | 2 | 16130 | import numpy as np
from uniclass_to_nf_ea_com_source.b_code.configurations.common_constants.uniclass_bclearer_constants import PARENT_CODE_COLUMN_NAME, \
UNICLASS2015_OBJECT_TABLE_NAME
def add_parent_code_column_to_uniclass_objects_table(
dictionary_of_dataframes: dict)\
-> dict:
uniclass_201... | 1.84375 | 2 |
ext/ANTsPyNet/antspynet/utilities/mixture_density_utilities.py | tsmonteiro/fmri_proc | 2 | 16131 | <reponame>tsmonteiro/fmri_proc<gh_stars>1-10
import keras.backend as K
from keras.engine import Layer, InputSpec
from keras.layers import Concatenate
from keras import initializers
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
class MixtureDensityLayer(Layer):
"""
Layer for... | 2.53125 | 3 |
test.py | pnawalramka/cowin | 0 | 16132 | <reponame>pnawalramka/cowin
import json
from unittest import mock, TestCase
import check_availability
json_data = \
"""
{
"centers": [
{
"center_id": 1234,
"name": "District General Hostpital",
"name_l": "",
"address": "45 M G Road",
"address_l": "",
"state_name": "Maharashtr... | 2.734375 | 3 |
pycon_project/apps/proposals/admin.py | mitsuhiko/pycon | 1 | 16133 | from django.contrib import admin
from proposals.models import Proposal, ProposalSessionType
admin.site.register(ProposalSessionType)
admin.site.register(Proposal,
list_display = ["title", "session_type", "audience_level", "cancelled", "extreme_pycon", "invited"]
) | 1.59375 | 2 |
cemc/mcmc/cov_reaction_crd.py | davidkleiven/WangLandau | 2 | 16134 | <reponame>davidkleiven/WangLandau
import sys
from cemc.mcmc import ReactionCrdInitializer, ReactionCrdRangeConstraint
import numpy as np
from itertools import product
import time
from numpy.linalg import inv
class CouldNotFindValidStateError(Exception):
pass
class CovarianceCrdInitializer(ReactionCrdInitializer... | 2.21875 | 2 |
mysql/main.py | migachevalexey/BigQuery-integrations | 0 | 16135 | <reponame>migachevalexey/BigQuery-integrations<gh_stars>0
from google.cloud import bigquery
from mysql.connector import connect
import os
# writeable part of the filesystem for Cloud Functions instance
gc_write_dir = "/tmp"
def get_file_mysql(mysql_configuration):
"""
Querying data using Connector/Python ... | 2.8125 | 3 |
arthur.carvalho/snakepro/game.py | LUDUSLab/stem-games | 2 | 16136 | from config import *
from fruit import *
from snakebody import *
from wall import *
def scoring(sp, ap):
global score
background_score = pygame.Surface(rectangle)
background_score.fill(color_gray)
score_text = score_font.render(f'Score: {score}', True, color_black, color_gray)
screen.blit(backg... | 2.8125 | 3 |
preprocessing_pipeline/so/util/log.py | sotorrent/preprocessing-pipeline | 0 | 16137 | <reponame>sotorrent/preprocessing-pipeline
import logging
from preprocessing_pipeline.so.util.config import LOG_LEVEL
def initialize_logger(logger_name):
"""
Configure a named logger (see https://stackoverflow.com/a/43794480).
"""
# create logger for module
module_logger = logging.getLogger(logg... | 2.65625 | 3 |
utilityFunction/CommandFunc.py | The-Fragment/FragmentFembot | 0 | 16138 | import random
# Ex. takes in 2d20 and outputs the string Rolling 2 d20
def roll_str(rolls):
numDice = rolls.split('d')[0]
diceVal = rolls.split('d')[1]
if numDice == '':
numDice = int(1)
return "Rolling %s d%s" % (numDice, diceVal)
# Ex. takes in 2d20 and outputs resultString = 11, 19 result... | 3.78125 | 4 |
src/reviews/tests/test_forms.py | Talengi/phase | 8 | 16139 | <filename>src/reviews/tests/test_forms.py
# -*- coding: utf-8 -*-
import datetime
from django.test import TestCase
from django.contrib.contenttypes.models import ContentType
from accounts.factories import UserFactory
from categories.factories import CategoryFactory
from documents.factories import DocumentFactory
fr... | 2.140625 | 2 |
WWW/pycopia/WWW/HTML5simple.py | kdart/pycopia | 89 | 16140 | #!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | 1.5625 | 2 |
zairachem/reports/report.py | ersilia-os/ersilia-automl-chem | 0 | 16141 | from .plots import (
ActivesInactivesPlot,
ConfusionPlot,
RocCurvePlot,
ProjectionPlot,
RegressionPlotRaw,
HistogramPlotRaw,
RegressionPlotTransf,
HistogramPlotTransf,
Transformation,
IndividualEstimatorsAurocPlot,
InidvidualEstimatorsR2Plot,
)
from .. import ZairaBase
from ... | 2.09375 | 2 |
tests/backend/configobj.py | edyan/python-anyconfig | 0 | 16142 | #
# Copyright (C) 2013 - 2017 <NAME> <<EMAIL>>
# License: MIT
#
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
# pylint: disable=ungrouped-imports
from __future__ import absolute_import
import anyconfig.backend.configobj as TT
import tests.backend.common as TBC
from anyconfig.compat import Or... | 2.25 | 2 |
backend/lorre/__init__.py | nhurman/Lorre | 0 | 16143 | __author__ = 'nhurman'
| 1.023438 | 1 |
tests/test_spider.py | aezhov/sw_downloader | 1 | 16144 | <reponame>aezhov/sw_downloader
import requests
from scrapy.http import HtmlResponse
from sw_downloader.sw_downloader.spiders.smashing_magazine \
import SmashingMagazineSpider
class TestSmashingMagazineSpider:
def test_ruleset(self):
url = ('https://www.smashingmagazine.com/category/wallpapers')
... | 2.53125 | 3 |
1_PROGI/Exe 5.py | Julymusso/IFES | 0 | 16145 | #var
#num, media, i: inteiro
media=0
for i in range(1,11,1):
num=int(input("Digite um número: "))
media = media+num
media=media/i
print (media) | 3.953125 | 4 |
rio/tasks.py | soasme/rio | 0 | 16146 | <reponame>soasme/rio
# -*- coding: utf-8 -*-
"""
rio.tasks
~~~~~~~~~~
Implement of rio tasks based on celery.
"""
from time import time
from celery import chord
from requests import ConnectionError
from celery.utils.log import get_task_logger
from rio.core import celery
from rio.core import sentry
from rio.utils.h... | 1.953125 | 2 |
security_app/createuserpoolgroup.py | jagalembu/chalice_cognito_multi_tenancy | 0 | 16147 | <filename>security_app/createuserpoolgroup.py
import os
import uuid
import json
import argparse
import boto3
USERPOOL = {
'env_var_poolid': 'APPUSERPOOLID',
'env_var_cognito_url': 'COGNITOJWKSURL',
'env_var_pool_client': 'APPCLIENTID',
}
def create_user_pool(pool_name, region, stage):
client = boto3... | 2.3125 | 2 |
Chapter 07/hmac-md5.py | Prakshal2607/Effective-Python-Penetration-Testing | 346 | 16148 | import hmac
hmac_md5 = hmac.new('secret-key')
f = open('sample-file.txt', 'rb')
try:
while True:
block = f.read(1024)
if not block:
break
hmac_md5.update(block)
finally:
f.close()
digest = hmac_md5.hexdigest()
print digest | 2.75 | 3 |
dingtalk/python/alibabacloud_dingtalk/alitrip_1_0/models.py | yndu13/dingtalk-sdk | 0 | 16149 | <reponame>yndu13/dingtalk-sdk
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
from typing import Dict, List
class AddCityCarApplyHeaders(TeaModel):
def __init__(
self,
common_headers: Dict[str, str] = None,
x_acs_dingtalk_access_... | 2.109375 | 2 |
src/while_exit.py | Alex9808/py101 | 25 | 16150 | <reponame>Alex9808/py101<gh_stars>10-100
#!/usr/bin/env python
''' Este programa se repetirá 3 veces o hasta que se ingrese
la palabra "despedida" y desplegará sólo el número de intentos
fallidos hasta que cualquiera de los eventos ocurentradara. Al
ingresar la palabra "termina" el programa se detendr... | 3.859375 | 4 |
src/kong/db.py | paulgessinger/kong | 3 | 16151 | <reponame>paulgessinger/kong
"""
Singleton database instance
"""
from typing import TYPE_CHECKING, Any, List, ContextManager, Tuple, Iterable
if not TYPE_CHECKING:
from playhouse.sqlite_ext import SqliteExtDatabase, AutoIncrementField
else: # pragma: no cover
class SqliteExtDatabase:
"""
Mypy... | 2.609375 | 3 |
selenium_wrapper/factory.py | dfeeley/selenium-wrapper | 1 | 16152 | <reponame>dfeeley/selenium-wrapper
import os
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.chrome.options import Options
from .driver import Driver
def remote(url, browser="chrome", **kwargs):
if browser != "chrome":
... | 2.5625 | 3 |
networking_cisco/tests/unit/saf/agent/vdp/test_lldpad.py | arvindsharma16/networking-cisco | 0 | 16153 | <reponame>arvindsharma16/networking-cisco<gh_stars>0
# Copyrigh 2015 Cisco Systems.
# 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.apac... | 1.859375 | 2 |
py/prospect/viewer/cds.py | segasai/prospect | 4 | 16154 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
===================
prospect.viewer.cds
===================
Class containing all bokeh's ColumnDataSource objects needed in viewer.py
"""
import numpy as np
from pkg_resources import resource_filename
import bokeh.plotting a... | 2.171875 | 2 |
tests/test_32_read_registration.py | jschlyter/oidcendpoint | 0 | 16155 | # -*- coding: latin-1 -*-
import json
import pytest
from oidcendpoint.endpoint_context import EndpointContext
from oidcendpoint.oidc.authorization import Authorization
from oidcendpoint.oidc.read_registration import RegistrationRead
from oidcendpoint.oidc.registration import Registration
from oidcendpoint.oidc.token i... | 1.875 | 2 |
thippiproject/modelapp/admin.py | Anandgowda18/djangocomplete | 0 | 16156 | from django.contrib import admin
from modelapp.models import Project
# Register your models here.
class Projectadmin(admin.ModelAdmin):
list_display = ['startdate','enddate','name','assignedto','priority']
admin.site.register(Project,Projectadmin) | 1.695313 | 2 |
2013.6/2015.6.py | luisalvaradoar/olimpiada.ct | 0 | 16157 | def transaccion(retiro, saldo):
if retiro % 5 != 0:
return(saldo)
elif (saldo - retiro) < 0:
return(saldo)
elif saldo == retiro:
return(saldo)
else:
return(saldo - retiro - 0.5)
def main():
entrada = open("input.txt","r")
salida = open("output.txt","w")
T = ... | 3.4375 | 3 |
hash.py | STR-Coding-Club/blockchain-demo | 0 | 16158 | <filename>hash.py
import hashlib, json
# def hash(to_hash):
# h = hashlib.md5()
# h.update(bytes(str(to_hash), 'utf-8'))
# return h.hexdigest()
def hash(to_hash, proof_of_work):
s = ''.join(str(_) for _ in (to_hash[:2])) #Add block number and previous hash to string
s += ''.join(str(_) for _ in (t... | 3.4375 | 3 |
covid-modeling-master/generate_ma_csv.py | rdkap42/caedus-covid | 10 | 16159 | import logging
import time
import numpy as np
from eda import ma_data, tx_data
from sir_fitting_us import seir_experiment, make_csv_from_tx_traj
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.info("Fitting model.")
# initial values taken from previous fit, used to seed MH sampler efficie... | 2.5 | 2 |
For_Simulator/learning/plot_gmm_nd.py | a-taniguchi/CSL-BGM | 1 | 16160 | #coding:utf-8
#gaussian plot (position category)
#<NAME> 2016/06/16
import itertools
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
import matplotlib as mpl
from sklearn import mixture
from __init__ import *
from numpy.random import multinomial,uniform,dirichlet
from scipy.stats ... | 2.015625 | 2 |
condiment/tests/test_simple.py | WeilerWebServices/Kivy | 3 | 16161 | <filename>condiment/tests/test_simple.py
#exclude
import condiment; condiment.install()
#endexclude
if WITH_TIMEBOMB:
timebomb = int(WITH_TIMEBOMB)
print 'timebomb feature is activated, and set to', timebomb
if WITH_INAPP_PURCHASE:
print 'inapp purchase feature is activated'
if WITH_TIMEBOMB and WITH_INA... | 1.882813 | 2 |
tests/init.py | touqir14/Emergent | 0 | 16162 | <gh_stars>0
import pathlib
import os
import sys
from multiprocessing import resource_tracker
def modify_resource_tracker():
# See discussion: https://bugs.python.org/issue39959
# See source code: https://github.com/python/cpython/blob/master/Lib/multiprocessing/resource_tracker.py
rt = resource_tracker._resource_t... | 2.265625 | 2 |
data-processor/modules/wikia_handler.py | stephanietuerk/art-history-jobs | 0 | 16163 | import csv
import re
import unicodedata
import bs4
import wikia
from modules import utils
from modules.config import Config
class WikiaHandler():
def __init__(self):
config = Config()
self.scraping_config = config.get_scraping_config()
self.parsing_config = config.get_parsing_config()
... | 2.875 | 3 |
ucsmsdk/mometa/cimcvmedia/CimcvmediaExtMgmtRuleEntry.py | anoop1984/python_sdk | 0 | 16164 | <reponame>anoop1984/python_sdk
"""This module contains the general information for CimcvmediaExtMgmtRuleEntry ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class CimcvmediaExtMgmtRuleEntryConsts():
... | 1.90625 | 2 |
paddlescience/pde/pde_navier_stokes.py | juneweng/PaddleScience | 0 | 16165 | <reponame>juneweng/PaddleScience
# Copyright (c) 2021 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.328125 | 2 |
tests/strict/it_mod_double_fun.py | Euromance/pycopy | 663 | 16166 | import mod
def foo():
return 1
try:
mod.foo = foo
except RuntimeError:
print("RuntimeError1")
print(mod.foo())
try:
mod.foo = 1
except RuntimeError:
print("RuntimeError2")
print(mod.foo)
try:
mod.foo = 2
except RuntimeError:
print("RuntimeError3")
print(mod.foo)
def __main__():
... | 3.046875 | 3 |
LungCancer.py | SpiroGanas/Lung-Cancer-Machine-Learning | 1 | 16167 | <gh_stars>1-10
# <NAME>
# 9/27/17
#
# Python 3 script to
######### NOTES ########################################
# 1. Each "slice" is a 512x512 image, stored in a single .dcm file.
# 2. A 3-dimensional CT Scan consists of between 94 and 541 slices (according to the Stage 1 data).
# 3. We need to rescale all the C... | 2.796875 | 3 |
setup.py | LEGO-Robotics/aistorms | 1 | 16168 | import json
import os
from setuptools import find_packages, setup
PACKAGE_NAMESPACE_NAME = 'aistorms'
METADATA_FILE_NAME = 'metadata.json'
REQUIREMENTS_FILE_NAME = 'requirements.txt'
_metadata = \
json.load(
open(os.path.join(
os.path.dirname(__file__),
PACKAGE_NAMESPAC... | 1.632813 | 2 |
scripts/merge.py | jgonzalezdemendibil/movie_publisher | 0 | 16169 | #!/usr/bin/python
# Copied from https://raw.githubusercontent.com/srv/srv_tools/kinetic/bag_tools/scripts/merge.py since this script is
# not released for indigo.
"""
Copyright (c) 2015,
<NAME>
Clearpath Robotics, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification... | 1.59375 | 2 |
src/pyforest/auto_import.py | tnwei/pyforest | 1,002 | 16170 | <gh_stars>1000+
from pathlib import Path
IPYTHON_STARTUP_FOLDER = Path.home() / ".ipython" / "profile_default" / "startup"
STARTUP_FILE = IPYTHON_STARTUP_FOLDER / "pyforest_autoimport.py"
def _create_or_reset_startup_file():
if STARTUP_FILE.exists():
STARTUP_FILE.unlink() # deletes the old file
... | 2.859375 | 3 |
tests/torch/pruning/test_model_pruning_analysis.py | sarthakpati/nncf | 0 | 16171 | <reponame>sarthakpati/nncf<filename>tests/torch/pruning/test_model_pruning_analysis.py
"""
Copyright (c) 2020 Intel 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.ap... | 1.375 | 1 |
tests/future_division_eval.py | mayl8822/onelinerizer | 1,062 | 16172 | <filename>tests/future_division_eval.py
from __future__ import division
print eval('1/2')
exec('print 1/2')
eval(compile('print 1/2', 'wat.py', 'exec'))
print eval(compile('1/2', 'wat.py', 'eval'))
print eval(compile('1/2', 'wat.py', 'eval', 0, 0))
print eval(compile('1/2', 'wat.py', 'eval', 0, ~0))
| 2.078125 | 2 |
matchms/similarity/spec2vec/__init__.py | fossabot/matchms | 0 | 16173 | from .Document import Document
from .SpectrumDocument import SpectrumDocument
from .Spec2Vec import Spec2Vec
__all__ = [
"Document",
"SpectrumDocument",
"Spec2Vec"
]
| 1.117188 | 1 |
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_wanphy_ui_oper.py | tkamata-test/ydk-py | 0 | 16174 | <filename>cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_wanphy_ui_oper.py<gh_stars>0
""" Cisco_IOS_XR_wanphy_ui_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR wanphy\-ui package operational data.
This module contains definitions
for the following management objects\:
wanphy\: WANP... | 1.976563 | 2 |
test/unit/solver/test_lamb.py | megvii-research/basecls | 23 | 16175 | <gh_stars>10-100
#!/usr/bin/env python3
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
import megengine as mge
import numpy as np
import pytest
from megengine.autodiff import GradManager
from basecls.solver.optimizer import LAMB
@pytest.mark.parametrize("weight_decay", [0.0, 0.001])
@pytest.mark.parametr... | 2.140625 | 2 |
onenote-dump/__main__.py | genericmoniker/onenote-dump | 39 | 16176 | import argparse
import logging
import os
import pathlib
import time
import log
import onenote_auth
import onenote
import pipeline
logger = logging.getLogger()
def main():
args = parse_args()
if args.verbose:
log.setup_logging(logging.DEBUG)
else:
log.setup_logging(logging.INFO)
# Al... | 2.4375 | 2 |
venv/lib/python3.8/site-packages/ansible_collections/community/aws/tests/unit/plugins/modules/test_data_pipeline.py | saeedya/docker-ansible | 7 | 16177 | # (c) 2017 Red Hat Inc.
#
# This file is part of Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import os
import json
import p... | 1.882813 | 2 |
Janela/Cadastro_clientes/Clientes.py | marcosj046/Treinando-Python-Tkinter | 0 | 16178 | <filename>Janela/Cadastro_clientes/Clientes.py<gh_stars>0
import sqlite3
import tkinter as tk
import pandas as pd
#----------------------------------------------
#Para criação do banco de dados retira o comentário (#) da linha 9 à 23 somente a primeira vez que rodar o cód,
#depois, basta comentar novamente.
#Criando ... | 3.390625 | 3 |
pygitbucket/client.py | SimiCode/pygitbucket | 1 | 16179 | import math
import requests
from pygitbucket.exceptions import (
UnknownError,
InvalidIDError,
NotFoundIDError,
NotAuthenticatedError,
PermissionError,
)
class Client:
BASE_URL = "https://api.bitbucket.org/"
def __init__(self, user: str, password: str, owner=None):
"""Initial ses... | 3.140625 | 3 |
egg/zoo/basic_games/data_readers.py | renata-nerenata/EGG | 1 | 16180 | <reponame>renata-nerenata/EGG
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch.utils.data import Dataset
import numpy as np
# These input-data-processing classes take ... | 3.09375 | 3 |
viroconcom/read_write.py | adrdrew/viroconcom | 0 | 16181 | <reponame>adrdrew/viroconcom<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Reads datasets, reads and writes contour coordinates.
"""
import numpy as np
import csv
def read_ecbenchmark_dataset(path='datasets/1year_dataset_A.txt'):
"""
Reads a 2D dataset that uses a an ASCI format wit... | 3.0625 | 3 |
check_python_install/check_numba.py | sdpython/_check_python_install | 0 | 16182 | """
@file
@brief Test for :epkg:`cartopy`.
"""
import numpy
import numba
@numba.jit(nopython=True, parallel=True)
def logistic_regression(Y, X, w, iterations):
"Fits a logistic regression."
for _ in range(iterations):
w -= numpy.dot(((1.0 / (1.0 + numpy.exp(-Y * numpy.dot(X, w))) - 1.0) * Y), X)
r... | 2.859375 | 3 |
app/utils/to_file.py | MichelHanzenScheeren/SpectralClustering | 0 | 16183 | class ToFile:
""" Classe que recebe uma instância de dados e os salva em um arquivo de saída. """
def __init__(self, path, data):
maxs = [len(x) + 4 for x in data.legend]
with open(path, 'w') as file:
file.write('id' + (' ' * 6))
for index, element in enumerate(data.legend):
file.write(... | 3.21875 | 3 |
Round 3/fence_design.py | e-ntro-py/GoogleCodeJam-2021 | 30 | 16184 | # Copyright (c) 2021 kamyu. All rights reserved.
#
# Google Code Jam 2021 Round 3 - Problem C. Fence Design
# https://codingcompetitions.withgoogle.com/codejam/round/0000000000436142/0000000000813bc7
#
# Time: O(NlogN) on average, pass in PyPy2 but Python2
# Space: O(N)
#
from random import seed, randint
# Compute t... | 2.96875 | 3 |
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/pygsl/_block.py | poojavade/Genomics_Docker | 1 | 16185 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.11
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path impo... | 2.0625 | 2 |
tests/__init__.py | chasefinch/amp-renderer | 13 | 16186 | <gh_stars>10-100
"""Tests for the AMP Renderer project."""
| 0.980469 | 1 |
sudoku/sudoku.py | Ostap2003/backtracking-team-project | 0 | 16187 |
from pprint import pprint
'''The module has class Grid for solving sudoku.
Grid should be given as a list of integers or a path to a file.
'''
class Grid():
'''Class for solving sudoku.
'''
def __init__(self, path= None, grid= None) -> None:
'''Initialize grid, columns, squares.
'''
... | 3.78125 | 4 |
device_e2e/sync/test_sync_c2d.py | dt-boringtao/azure-iot-sdk-python | 0 | 16188 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
import pytest
import logging
import json
import threading
from utils import get_random_dict
logger = logging.getLogger(__name__)
logger.setLevel(level=logging.INF... | 2.0625 | 2 |
addons/mixer/blender_data/tests/test_bpy_blend_diff.py | trisadmeslek/V-Sekai-Blender-tools | 0 | 16189 | # GPLv3 License
#
# Copyright (C) 2020 Ubisoft
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is dis... | 1.828125 | 2 |
dependencies/svgwrite/examples/ltattrie/tiling_part_5.py | charlesmchen/typefacet | 21 | 16190 | <reponame>charlesmchen/typefacet
#!/usr/bin/python
# -*- coding: utf-8 -*-
import math, sys
import svgwrite
#
# http://www.w3.org/TR/SVG11/struct.html#UseElement
#
# For more information on tesselation / tiling see http://en.wikipedia.org/wiki/Wallpaper_group
# The organization of these tilings are from the i... | 2.953125 | 3 |
MIssions_to_Mars/scrape_mars_mission.py | pwickliff1/web-scraping-challenge | 0 | 16191 | <filename>MIssions_to_Mars/scrape_mars_mission.py
# Dependencies
from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
def scrape():
mars_data = {}
# Url of website to be scraped
url = 'https://mars.nasa.gov/news/'
response = requests.get(url)
soup = BeautifulSoup(... | 3.34375 | 3 |
guiapp/meditech_nls_parser/old/meditech_nls_to_xml.py | gcampuzano14/PathISTabs | 1 | 16192 | <filename>guiapp/meditech_nls_parser/old/meditech_nls_to_xml.py
#!/usr/bin/env python
import os
import re
import csv
def fil():
filetext = os.path.join(os.path.dirname(__file__),'meditech_data','RAW')
#filetext = "C:/Users/gcampuzanozuluaga/Dropbox/Programming/Python/APPS/meditech_data/MT/RAW"
... | 2.59375 | 3 |
paper_plots/small_vs_large_box.py | finn-dodgson/DeepHalos | 0 | 16193 | import numpy as np
from plots import plots_for_predictions as pp
from utilss import distinct_colours as dc
import matplotlib.pyplot as plt
c = dc.get_distinct(4)
path = '/Users/luisals/Documents/deep_halos_files/mass_range_13.4/random_20sims_200k/lr5e-5/'
p1 = np.load(path + "seed_20/predicted_sim_6_epoch_09.npy")
t1... | 1.851563 | 2 |
configs/semantic_guided/CE.py | hukkelas/full_body_anonymization | 27 | 16194 | _base_config_ = ["base.py"]
generator = dict(
input_cse=True,
use_cse=True
)
discriminator=dict(
pred_only_cse=False,
pred_only_semantic=True
)
loss = dict(
gan_criterion=dict(type="segmentation", seg_weight=.1)
)
| 1.757813 | 2 |
test/compiler/test-encode.py | xupingmao/minipy | 52 | 16195 | <reponame>xupingmao/minipy
# -*- coding:utf-8 -*-
# @author xupingmao <<EMAIL>>
# @since 2020/10/20 00:19:47
# @modified 2020/10/20 00:42:52
import sys
sys.path.append("src/python")
from mp_encode import *
def test_compile(fname):
input_fname = "test/compiler/case/%s-input.py" % fname
output_fname = "test/... | 2.25 | 2 |
paragen/optim/__init__.py | godweiyang/ParaGen | 0 | 16196 | from copy import deepcopy
from inspect import getfullargspec
import importlib
import json
import os
import logging
logger = logging.getLogger(__name__)
from torch.optim.optimizer import Optimizer
from paragen.optim.optimizer import Optimizer
from paragen.utils.rate_schedulers import create_rate_scheduler
from paragen... | 2.03125 | 2 |
joyvillage/joy/views.py | IreneMercy/Joy-Village-Backup | 0 | 16197 | <reponame>IreneMercy/Joy-Village-Backup
from __future__ import unicode_literals
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect
from .models import Events, Gallery, News, Careers, Partners
from django.core.mail import send_mail,BadHeaderError
from django.conf imp... | 2.046875 | 2 |
src/events/admin.py | cbsBiram/xarala__ssr | 0 | 16198 | <filename>src/events/admin.py
from django.contrib import admin
from django_summernote.admin import SummernoteModelAdmin
from .models import Event, Speaker
class EventAdmin(SummernoteModelAdmin):
summernote_fields = ("content",)
admin.site.register(Event, EventAdmin)
admin.site.register(Speaker)
| 1.484375 | 1 |
python/cython_build.py | n1tk/batch_jaro_winkler | 22 | 16199 | <filename>python/cython_build.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import sys
python_version = sys.version_info[0]
setup(
name='batch_jaro_winkler',
ext_modules=cythonize([Extension('batch_jaro_winkler', ['cbatch_jaro_winkler.pyx'])], l... | 1.453125 | 1 |