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
testcases/cloud_admin/services_up_test.py
tbeckham/eutester
0
6300
<gh_stars>0 #!/usr/bin/python # Software License Agreement (BSD License) # # Copyright (c) 2009-2011, Eucalyptus Systems, Inc. # All rights reserved. # # Redistribution and use of this software in source and binary forms, with or # without modification, are permitted provided that the following conditions # are met: # ...
1.546875
2
intValues.py
jules552/ProjetISN
0
6301
MAP = 1 SPEED = 1.5 VELOCITYRESET = 6 WIDTH = 1280 HEIGHT = 720 X = WIDTH / 2 - 50 Y = HEIGHT / 2 - 50 MOUSER = 325 TICKRATES = 120 nfc = False raspberry = False
1.203125
1
April/Apr_25_2019/builder.py
while1618/DailyCodingProblem
1
6302
<reponame>while1618/DailyCodingProblem # This problem was asked by Facebook. # # A builder is looking to build a row of N houses that can be of K different colors. # He has a goal of minimizing cost while ensuring that no two neighboring houses are of the same color. # # Given an N by K matrix where the nth row and kth...
2.984375
3
experiments/delaney/plot.py
pfnet-research/bayesgrad
57
6303
import argparse import numpy as np import os import sys import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) from saliency.visualizer.smiles_visualizer import SmilesVisualizer def visualize(dir_path): ...
2.3125
2
public/js/tinymice/plugins/bootstrap/jquery-file-tree/connectors/jqueryFileTree.py
btybug/main.albumbugs
13
6304
# # jQuery File Tree # Python/Django connector script # By <NAME> # import os import urllib def dirlist(request): r=['<ul class="jqueryFileTree" style="display: none;">'] try: r=['<ul class="jqueryFileTree" style="display: none;">'] d=urllib.unquote(request.POST.get('dir','c:\\temp')) for f ...
2.140625
2
gpytorch/lazy/chol_lazy_tensor.py
harvineet/gpytorch
0
6305
<filename>gpytorch/lazy/chol_lazy_tensor.py #!/usr/bin/env python3 import torch from .lazy_tensor import LazyTensor from .root_lazy_tensor import RootLazyTensor from .. import settings class CholLazyTensor(RootLazyTensor): def __init__(self, chol): if isinstance(chol, LazyTensor): # Probably is an inst...
2.0625
2
pirates/audio/AmbientManagerBase.py
ksmit799/POTCO-PS
8
6306
<filename>pirates/audio/AmbientManagerBase.py # File: A (Python 2.4) from pandac.PandaModules import AudioSound from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import LerpFunc, Sequence from direct.showbase.DirectObject import DirectObject class AmbientSound: notify = Direct...
2.3125
2
test/tests/import_test.py
jmgc/pyston
1
6307
<gh_stars>1-10 import import_target print import_target.x import import_target import_target.foo() c = import_target.C() print import_target.import_nested_target.y import_target.import_nested_target.bar() d = import_target.import_nested_target.D() print "testing importfrom:" from import_target import x as z print z...
2.40625
2
hexrd/ui/matrix_editor.py
HEXRD/hexrdgui
13
6308
import numpy as np from PySide2.QtCore import QSignalBlocker, Signal from PySide2.QtWidgets import QGridLayout, QWidget from hexrd.ui.scientificspinbox import ScientificDoubleSpinBox DEFAULT_ENABLED_STYLE_SHEET = 'background-color: white' DEFAULT_DISABLED_STYLE_SHEET = 'background-color: #F0F0F0' INVALID_MATRIX_STY...
2.328125
2
data/train/python/990aa6cbf16ed34f5030609c03ab43c0f0ed8c2aurls.py
harshp8l/deep-learning-lang-detection
84
6309
from django.conf.urls.defaults import * urlpatterns = patterns('pytorque.views', (r'^$', 'central_dispatch_view'), (r'^browse$', 'central_dispatch_view'), (r'^monitor$', 'central_dispatch_view'), (r'^submit$', 'central_dispatch_view'), (r'^stat$', 'central_dispatch_view'), (r'^login/$', 'login...
1.726563
2
checkerpy/types/all/typedtuple.py
yedivanseven/CheckerPy
1
6310
from typing import Tuple, Union, Any, Sequence from collections import deque, defaultdict, OrderedDict from ...validators.one import JustLen from ...functional.mixins import CompositionClassMixin from ..one import Just dict_keys = type({}.keys()) odict_keys = type(OrderedDict({}).keys()) dict_values = type({}.values()...
2.84375
3
data/analyzer/linux/lib/common/abstracts.py
iswenhao/Panda-Sandbox
2
6311
<gh_stars>1-10 # Copyright (C) 2014-2016 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file 'docs/LICENSE' for copying permission. from lib.api.process import Process from lib.exceptions.exceptions import CuckooPackageError class Package(object): """Base abstrac...
2.0625
2
rdmo/options/apps.py
Raspeanut/rdmo
1
6312
from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class OptionsConfig(AppConfig): name = 'rdmo.options' verbose_name = _('Options')
1.382813
1
main/admin.py
sirodoht/mal
2
6313
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from main import models class Admin(UserAdmin): list_display = ("id", "username", "email", "date_joined", "last_login") admin.site.register(models.User, Admin) class DocumentAdmin(admin.ModelAdmin): list_display = ("id", "ti...
2.078125
2
cloudshell/cli/configurator.py
QualiSystems/cloudshell-cli
4
6314
<gh_stars>1-10 #!/usr/bin/python # -*- coding: utf-8 -*- import sys from abc import ABCMeta, abstractmethod from collections import defaultdict from cloudshell.cli.factory.session_factory import ( CloudInfoAccessKeySessionFactory, GenericSessionFactory, SessionFactory, ) from cloudshell.cli.service.cli imp...
2.015625
2
examples/ingenerator.py
quynhanh-ngx/pytago
206
6315
def main(): n = 111 gen = (n * 7 for x in range(10)) if 777 in gen: print("Yes!") if __name__ == '__main__': main()
3.25
3
source/packages/scs-pm-server/src/python-server/app.py
amittkSharma/scs_predictive_maintenance
0
6316
import json import logging import joblib import pandas as pd from flask import Flask, jsonify, request from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) @app.route("/api/machinePrediction", methods=['GET']) def home(): incomingMachineId = request.args.get('machineId') modelPath = requ...
2.6875
3
tests/test_remove_from_dependee_chain.py
ess-dmsc/nexus-constructor
3
6317
import pytest from PySide2.QtGui import QVector3D from nexus_constructor.model.component import Component from nexus_constructor.model.dataset import Dataset from nexus_constructor.model.instrument import Instrument from nexus_constructor.model.value_type import ValueTypes values = Dataset( name="scalar_value", ...
2.09375
2
fastmvsnet/train1.py
molspace/FastMVS_experiments
0
6318
<filename>fastmvsnet/train1.py #!/usr/bin/env python import argparse import os.path as osp import logging import time import sys sys.path.insert(0, osp.dirname(__file__) + '/..') import torch import torch.nn as nn from fastmvsnet.config import load_cfg_from_file from fastmvsnet.utils.io import mkdir from fastmvsnet.u...
1.992188
2
modulo2/3-detectores/3.2-detector/models.py
fossabot/unifacisa-visao-computacional
0
6319
<reponame>fossabot/unifacisa-visao-computacional # Estrutura básica para projetos de Machine Learning e Deep Learning # Por <NAME>. from torch import nn, relu import torch.nn.functional as F import torch.optim as optim import torch from torchvision import models class ResNet(nn.Module): def __init__(self, saida,...
3.34375
3
python/setup.py
sbrodeur/evert
28
6320
<filename>python/setup.py #!/usr/bin/env python # Copyright (c) 2017, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyrig...
1.039063
1
somegame/fps_osd.py
kodo-pp/somegame-but-not-that-one
0
6321
import pygame from loguru import logger from somegame.osd import OSD class FpsOSD(OSD): def __init__(self, game): super().__init__(game) logger.info('Loading font') self.font = pygame.font.Font(pygame.font.get_default_font(), 32) def draw(self, surface): fps = self.game.get_a...
2.671875
3
python/chronos/test/bigdl/chronos/data/experimental/test_xshardstsdataset.py
sgwhat/BigDL
0
6322
<reponame>sgwhat/BigDL # # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
2.1875
2
zoom_functions.py
WXSD-Sales/ZoomToWebex
1
6323
import json import tornado.gen import traceback from base64 import b64encode from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPError from settings import Settings from mongo_db_controller import ZoomUserDB @tornado.gen.coroutine def zoomRefresh(zoom_user): url = "https://zoom.us/oauth/token" p...
2.359375
2
crypten/mpc/__init__.py
gmuraru/CrypTen
0
6324
<gh_stars>0 #!/usr/bin/env python3 # 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 os from crypten.mpc import primitives # noqa: F401 from crypten.mpc import provider # noqa: F40 ...
1.953125
2
contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/pyflakes.py
lahosken/pants
0
6325
<reponame>lahosken/pants<filename>contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/pyflakes.py<gh_stars>0 # coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, divi...
1.976563
2
pharmrep/forum/models.py
boyombo/pharmrep
0
6326
<gh_stars>0 from django.db import models from django.contrib.auth.models import User from django.contrib import admin from django.utils.translation import ugettext_lazy as _ class Forum(models.Model): title = models.CharField(max_length=60) description = models.TextField(blank=True, default='') updated = m...
2.21875
2
iri-node/fabfile.py
jinnerbichler/home-automflashion
8
6327
<gh_stars>1-10 import time from fabric.api import run, env, task, put, cd, local, sudo env.use_ssh_config = True env.hosts = ['iota_node'] @task(default=True) def iri(): run('mkdir -p /srv/private-tangle/') with cd('/srv/private-tangle'): put('.', '.') run('docker-compose --project-name priva...
1.882813
2
features.py
ptorresmanque/MachineLearning_v2.0
0
6328
import sqlite3 from random import randint, choice import numpy as np conn = sqlite3.connect('ej.db') c = conn.cursor() #OBTENIENDO TAMAnOS MAXIMOS MINIMOS Y PROMEDIO# c.execute('SELECT MAX(alto) FROM features') resultado = c.fetchone() if resultado: altoMax = resultado[0] c.execute('SELECT MIN(alto) FROM featu...
3.015625
3
dev/ideas/cython/playing_around.py
achilleas-k/brian2
0
6329
<filename>dev/ideas/cython/playing_around.py from pylab import * import cython import time, timeit from brian2.codegen.runtime.cython_rt.modified_inline import modified_cython_inline import numpy from scipy import weave import numexpr import theano from theano import tensor as tt tau = 20 * 0.001 N = 100000...
1.9375
2
azbankgateways/views/__init__.py
lordmahyar/az-iranian-bank-gateways
196
6330
<reponame>lordmahyar/az-iranian-bank-gateways<gh_stars>100-1000 from .banks import callback_view, go_to_bank_gateway from .samples import sample_payment_view, sample_result_view
1.09375
1
dev/unittest/update.py
PowerDNS/exabgp
8
6331
#!/usr/bin/env python # encoding: utf-8 """ update.py Created by <NAME> on 2009-09-06. Copyright (c) 2009-2013 Exa Networks. All rights reserved. """ import unittest from exabgp.configuration.environment import environment env = environment.setup('') from exabgp.bgp.message.update.update import * from exabgp.bgp.me...
2.3125
2
nuscenes/eval/detection/evaluate.py
WJ-Lai/NightFusion
0
6332
# nuScenes dev-kit. # Code written by <NAME> & <NAME>, 2018. # Licensed under the Creative Commons [see licence.txt] import argparse import json import os import random import time from typing import Tuple, Dict, Any import numpy as np from nuscenes import NuScenes from nuscenes.eval.detection.algo import accumulate...
2.171875
2
tests/get_problem_atcoder.py
aberent/api-client
0
6333
<reponame>aberent/api-client import unittest from onlinejudge_api.main import main class DownloadAtCoderTest(unittest.TestCase): def test_icpc2013spring_a(self): """This problem contains both words `Input` and `Output` for the headings for sample outputs. """ url = 'http://jag2013spring....
3.109375
3
odm/libexec/odm_tenant.py
UMCollab/ODM
2
6334
<reponame>UMCollab/ODM #!/usr/bin/env python3 # This file is part of ODM and distributed under the terms of the # MIT license. See COPYING. import json import sys import odm.cli def main(): cli = odm.cli.CLI(['action']) client = cli.client if cli.args.action == 'list-users': print(json.dumps(c...
2.140625
2
tests/test_tag_value_parser.py
quaresmajose/tools-python
74
6335
# Copyright (c) 2014 <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, softwar...
2.125
2
mount_drives.py
DT-was-an-ET/fanshim-python-pwm
0
6336
# Standard library imports from subprocess import call as subprocess_call from utility import fileexists from time import sleep as time_sleep from datetime import datetime mount_try = 1 not_yet = True done = False start_time = datetime.now() if fileexists("/home/rpi4-sftp/usb/drive_present.txt"): when_usba...
2.609375
3
home/views.py
Kshitij-Kumar-Singh-Chauhan/docon
0
6337
from django.http.response import HttpResponse from django.shortcuts import render from django.shortcuts import redirect, render from cryptography.fernet import Fernet from .models import Book, UserDetails from .models import Contact from .models import Book from .models import Report from .models import Diagnostic from...
2.203125
2
hkube_python_wrapper/storage/base_storage_manager.py
kube-HPC/python-wrapper.hkube
1
6338
class BaseStorageManager(object): def __init__(self, adpter): self.adapter = adpter def put(self, options): try: return self.adapter.put(options) except Exception: raise Exception('Failed to write data to storage') def get(self, options): try: ...
3.0625
3
compressor/tests/templatetags.py
bigmlcom/django_compressor
0
6339
<reponame>bigmlcom/django_compressor from __future__ import with_statement import os import sys from mock import Mock from django.template import Template, Context, TemplateSyntaxError from django.test import TestCase from compressor.conf import settings from compressor.signals import post_compress from compressor....
2.234375
2
cle/cle/backends/relocations/generic.py
Ruide/angr-dev
0
6340
<reponame>Ruide/angr-dev from ...address_translator import AT from ...errors import CLEOperationError from . import Relocation import struct import logging l = logging.getLogger('cle.relocations.generic') class GenericAbsoluteReloc(Relocation): @property def value(self): return self.resolvedby.rebased...
1.851563
2
codes/Lib/site-packages/openpyxl/writer/tests/test_style.py
charlescayno/automation
0
6341
# Copyright (c) 2010-2014 openpyxl import pytest from openpyxl.styles.borders import Border, Side from openpyxl.styles.fills import GradientFill from openpyxl.styles.colors import Color from openpyxl.writer.styles import StyleWriter from openpyxl.tests.helper import get_xml, compare_xml class DummyWorkbook: st...
2.421875
2
ringapp/migrations/0009_auto_20150116_1759.py
rschwiebert/RingApp
10
6342
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('ringapp', '0008_auto_20150116_1755'), ] operations = [ migrations.AlterModelTable( name='invarian...
1.382813
1
front-end/testsuite-python-lib/Python-3.1/Lib/json/tests/test_dump.py
MalloyPower/parsing-python
1
6343
from unittest import TestCase from io import StringIO import json class TestDump(TestCase): def test_dump(self): sio = StringIO() json.dump({}, sio) self.assertEquals(sio.getvalue(), '{}') def test_dumps(self): self.assertEquals(json.dumps({}), '{}') def test_encode_truef...
3.03125
3
src/resources/clients/python_client/visitstate.py
visit-dav/vis
226
6344
<reponame>visit-dav/vis import sys class RPCType(object): CloseRPC = 0 DetachRPC = 1 AddWindowRPC = 2 DeleteWindowRPC = 3 SetWindowLayoutRPC = 4 SetActiveWindowRPC = 5 ClearWindowRPC = 6 ClearAllWindowsRPC = 7 OpenDatabaseRPC = 8 CloseData...
1.554688
2
tests/__init__.py
zhangyiming07/QT4C
53
6345
# -*- coding: utf-8 -*- # # Tencent is pleased to support the open source community by making QT4C available. # Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved. # QT4C is licensed under the BSD 3-Clause License, except for the third-party components listed below. # A copy of the BSD 3-Cla...
1.6875
2
brute/brute_build.py
sweetsbeats/starter-snake-python
0
6346
from cffi import FFI ffibuilder = FFI() ffibuilder.cdef(""" int test(int t); """) ffibuilder.set_source("_pi_cffi", """ #include "brute.h" """, sources=['brute.c']) if __name__ == "__main__": ffibuilder.compile(verbose = Tru...
1.234375
1
src/board.py
JNotelddim/python-snake
0
6347
"""Board Module""" import copy from typing import Tuple, List from src.coordinate import Coordinate from src.snake import Snake class Board: """Track the cooardinates for all snakes and food in the game.""" def __init__(self, data): self._data = data self._snakes = None self._foods = No...
3.875
4
personalized_nlp/datasets/wiki/base.py
CLARIN-PL/personalized-nlp
0
6348
<reponame>CLARIN-PL/personalized-nlp import os import zipfile from typing import List import pandas as pd import urllib from personalized_nlp.settings import STORAGE_DIR from personalized_nlp.utils.data_splitting import split_texts from personalized_nlp.datasets.datamodule_base import BaseDataModule class WikiDataM...
2.671875
3
App/migrations/0010_remove_user_percentage_preferences_user_preferences.py
dlanghorne0428/StudioMusicPlayer
0
6349
<filename>App/migrations/0010_remove_user_percentage_preferences_user_preferences.py # Generated by Django 4.0 on 2022-03-03 02:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('App', '0009_alter_song_holiday_alter_songfileinput_holiday'), ] o...
1.375
1
venv/Lib/site-packages/captcha/conf/settings.py
Rudeus3Greyrat/admin-management
1
6350
import os import warnings from django.conf import settings CAPTCHA_FONT_PATH = getattr(settings, 'CAPTCHA_FONT_PATH', os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'fonts/Vera.ttf'))) CAPTCHA_FONT_SIZE = getattr(settings, 'CAPTCHA_FONT_SIZE', 22) CAPTCHA_LETTER_ROTATION = getattr(settings, 'CAPTCHA_L...
1.898438
2
pilbox/test/app_test.py
joevandyk/pilbox
0
6351
<filename>pilbox/test/app_test.py<gh_stars>0 from __future__ import absolute_import, division, print_function, \ with_statement import logging import os.path import time import tornado.escape import tornado.gen import tornado.ioloop from tornado.test.util import unittest from tornado.testing import AsyncHTTPTestC...
2.21875
2
hackathon/darkmattertemperaturedistribution/example.py
Neelraj21/phython
6
6352
<filename>hackathon/darkmattertemperaturedistribution/example.py<gh_stars>1-10 #!/usr/bin/env python from scipy import * from pylab import * #from pylab import imshow #! #! Some graphical explorations of the Julia sets with python and pyreport #!######################################################################### ...
2.671875
3
resources/migrations/0126_add_field_disallow_overlapping_reservations_per_user.py
codepointtku/respa
1
6353
# Generated by Django 2.2.21 on 2021-06-23 12:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('resources', '0125_add_timmi_payload_model'), ] operations = [ migrations.AddField( model_name=...
1.507813
2
src/lora_multihop/module_config.py
marv1913/lora_multihop
0
6354
import logging from lora_multihop import serial_connection, variables def config_module(configuration=variables.MODULE_CONFIG): if serial_connection.execute_command(configuration, [variables.STATUS_OK]): serial_connection.execute_command('AT+SEND=1', [variables.STATUS_OK]) serial_connection.execu...
2.34375
2
eris/script/ferdian.py
ferdianap/Eris_test
1
6355
<reponame>ferdianap/Eris_test #!/usr/bin/env python # Copyright (c) 2013-2014, Rethink Robotics # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain ...
1.40625
1
core/src/main/python/akdl/entry/base_entry.py
zhangjun0x01/Alink
3,301
6356
import abc from typing import Dict, Callable import tensorflow as tf from flink_ml_framework.context import Context from flink_ml_framework.java_file import * from ..runner import tf_helper, io_helper from ..runner.output_writer import DirectOutputWriter try: from flink_ml_tensorflow.tensorflow_context import TF...
2.140625
2
corm-tests/test_corm_api.py
jbcurtin/cassandra-orm
1
6357
import pytest ENCODING = 'utf-8' @pytest.fixture(scope='function', autouse=True) def setup_case(request): def destroy_case(): from corm import annihilate_keyspace_tables, SESSIONS annihilate_keyspace_tables('mykeyspace') for keyspace_name, session in SESSIONS.copy().items(): if...
2.1875
2
src/utilities/getInfo.py
UCSB-dataScience-ProjectGroup/movie_rating_prediction
2
6358
import json import os from utilities.SaveLoadJson import SaveLoadJson as SLJ from utilities.LineCount import LineCount as LC import subprocess from geolite2 import geolite2 class getData: #Get Data Functions ------------------------------------------------------ @staticmethod def getDATA(): resu...
2.609375
3
nemo/collections/nlp/losses/__init__.py
KalifiaBillal/NeMo
1
6359
from nemo.collections.nlp.losses.sgd_loss import SGDDialogueStateLoss
1.054688
1
netrunner/test_settings.py
MrAGi/netrunner-cambridge
0
6360
# -*- coding: utf-8 -*- from .settings import * DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': os.environ['LOCAL_DB_NAME'], 'USER': os.environ['LOCAL_DB_USER'], 'PASSWORD': os.environ['LOCAL_DB_PASSWORD']...
1.28125
1
Python_Exercicios/calcula_terreno.py
thalles-dreissig20/Quebra_Cabeca
0
6361
def area(larg, comp): a = larg * comp print(f'A dimensão é {a}') print('Controle de terrenos') print('-' * 20) l = float(input('qual a largura do terreno: ')) c = float(input('qual o comprimento do terreno: ')) area(l , c)
3.71875
4
Desafios/desafio_041.py
romulogoleniesky/Python_C_E_V
0
6362
<reponame>romulogoleniesky/Python_C_E_V import datetime ano = (datetime.datetime.now()).year nasc = int(input("Digite o seu ano de nascimento: ")) categoria = 0 if (ano - nasc) <= 9: categoria = str("MIRIM") elif 9 < (ano - nasc) <= 14: categoria = str("INFANTIL") elif 14 < (ano - nasc) <= 19 : categoria = ...
4.03125
4
eval/metrics.py
RecoHut-Stanzas/S168471
37
6363
<filename>eval/metrics.py import torch def ndcg_binary_at_k_batch_torch(X_pred, heldout_batch, k=100, device='cpu'): """ Normalized Discounted Cumulative Gain@k for for predictions [B, I] and ground-truth [B, I], with binary relevance. ASSUMPTIONS: all the 0's in heldout_batch indicate 0 relevance. ""...
2.390625
2
simba/run_dash_tkinter.py
justinshenk/simba
172
6364
# All credit to https://stackoverflow.com/questions/46571448/tkinter-and-a-html-file - thanks DELICA - https://stackoverflow.com/users/7027346/delica from cefpython3 import cefpython as cef import ctypes try: import tkinter as tk from tkinter import messagebox except ImportError: import Tkinter as tk impo...
2.78125
3
domain_data/mujoco_worlds/make_xml.py
sfpd/rlreloaded
0
6365
<gh_stars>0 import re def do_substitution(in_lines): lines_iter = iter(in_lines) defn_lines = [] while True: try: line = lines_iter.next() except StopIteration: raise RuntimeError("didn't find line starting with ---") if line.startswith('---'): bre...
2.90625
3
myproject/apps/events/migrations/0002_alter_eventhero_options.py
cahyareza/django_admin_cookbook
0
6366
<reponame>cahyareza/django_admin_cookbook # Generated by Django 3.2.12 on 2022-03-28 11:57 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('events', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='eventhero', ...
1.46875
1
hilton_sign_in.py
bmintz/python-snippets
2
6367
#!/usr/bin/env python3 # encoding: utf-8 import sys import urllib.parse import selenium.webdriver def exit(): driver.quit() sys.exit(0) driver = selenium.webdriver.Firefox() # for some reason, detectportal.firefox.com and connectivitycheck.gstatic.com are not blocked # therefore, they cannot be used to detect con...
2.6875
3
src/figures/trends/leaf_response.py
rhyswhitley/savanna_iav
0
6368
<reponame>rhyswhitley/savanna_iav #!/usr/bin/env python import os from collections import OrderedDict import cPickle as pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.cm import get_cmap from matplotlib import style from scipy import ...
2.546875
3
app/index.py
vprnet/school-closings
0
6369
<reponame>vprnet/school-closings #!/usr/local/bin/python2.7 from flask import Flask import sys from flask_frozen import Freezer from upload_s3 import set_metadata from config import AWS_DIRECTORY app = Flask(__name__) app.config.from_object('config') from views import * # Serving from s3 leads to some complications...
2.25
2
proxyclient/linux.py
modwizcode/m1n1
1
6370
<filename>proxyclient/linux.py #!/usr/bin/python from setup import * payload = open(sys.argv[1], "rb").read() dtb = open(sys.argv[2], "rb").read() if len(sys.argv) > 3: initramfs = open(sys.argv[3], "rb").read() initramfs_size = len(initramfs) else: initramfs = None initramfs_size = 0 compressed_size...
2.140625
2
src/server.py
shizhongpwn/ancypwn
1
6371
<reponame>shizhongpwn/ancypwn<filename>src/server.py import json import os import multiprocessing import struct import importlib from socketserver import TCPServer, StreamRequestHandler def plugin_module_import(name): try: return importlib.import_module(name) except ModuleNotFoundError as e: p...
2.15625
2
pytorch_utils/collection_utils.py
c-hofer/pytorch_utils
0
6372
<reponame>c-hofer/pytorch_utils def keychain_value_iter(d, key_chain=None, allowed_values=None): key_chain = [] if key_chain is None else list(key_chain).copy() if not isinstance(d, dict): if allowed_values is not None: assert isinstance(d, allowed_values), 'Value needs to be of type {}!'.f...
2.5625
3
speech_to_text/views.py
zace3d/video_analysis
0
6373
from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from . import helpers # Create your views here. @csrf_exempt def convert_video(request, version): # Get video video = reques...
1.875
2
security_monkey/watchers/vpc/vpn.py
boladmin/security_monkey
4,258
6374
<reponame>boladmin/security_monkey # 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.140625
2
particle.py
coush001/Imperial-MSc-Group-Project-2
0
6375
from itertools import count import numpy as np class Particle(object): """Object containing all the properties for a single particle""" _ids = count(0) def __init__(self, main_data=None, x=np.zeros(2)): self.id = next(self._ids) self.main_data = main_data self.x = np.array(x) ...
3.015625
3
app/main/form.py
hussein18149/PITCHBOARD
0
6376
<reponame>hussein18149/PITCHBOARD from flask_wtf import FlaskForm from wtforms import StringField,TextAreaField,SubmitField from wtforms.validators import Required class UpdateProfile(FlaskForm): about = TextAreaField('Tell us about you.',validators = [Required()]) submit = SubmitField('Submit') class PitchFo...
2.734375
3
soar_instruments/sami/adclass.py
soar-telescope/dragons-soar
1
6377
<reponame>soar-telescope/dragons-soar import re import astrodata from astrodata import (astro_data_tag, TagSet, astro_data_descriptor, returns_list) from astrodata.fits import FitsLoader, FitsProvider from ..soar import AstroDataSOAR class AstroDataSAMI(AstroDataSOAR): __keyword_dict = di...
2.53125
3
practice/src/design_pattern/TemplateMethod.py
t10471/python
0
6378
# -*- coding: utf-8 -*- #単なる継承 class Base(object): def __init__(self): pass def meth(self, int): return self._meth(int) def _meth(self, int): return int class Pow(Base): def _meth(self, int): return pow(int,int)
3.390625
3
yoon/stage1_kernel.py
yoon28/realsr-noise-injection
17
6379
<reponame>yoon28/realsr-noise-injection import os, sys import numpy as np import cv2 import random import torch from configs import Config from kernelGAN import KernelGAN from data import DataGenerator from learner import Learner import tqdm DATA_LOC = "/mnt/data/NTIRE2020/realSR/track2" # "/mnt/data/NTIRE2020/real...
2.234375
2
test/rdfa/test_non_xhtml.py
RDFLib/PyRDFa
8
6380
from unittest import TestCase from pyRdfa import pyRdfa class NonXhtmlTest(TestCase): """ RDFa that is in not well-formed XHTML is passed through html5lib. These tests make sure that this RDFa can be processed both from a file, and from a URL. """ target1 = '<og:isbn>9780596516499</og:isbn>'...
3.0625
3
python/pyoai/setup.py
jr3cermak/robs-kitchensink
0
6381
<reponame>jr3cermak/robs-kitchensink from setuptools import setup, find_packages from os.path import join, dirname setup( name='pyoai', version='2.4.6.b', author='Infrae', author_email='<EMAIL>', url='https://github.com/jr3cermak/robs-kitchensink/tree/master/python/pyoai', classifiers=["Develop...
1.632813
2
utils/functions.py
Roozbeh-Bazargani/CPSC-533R-project
0
6382
<filename>utils/functions.py import torch from torch import nn import math #0 left hip #1 left knee #2 left foot #3 right hip #4 right knee #5 right foot #6 middle hip #7 neck #8 nose #9 head #10 left shoulder #11 left elbow #12 left wrist #13 right shoulder #14 right elbow #15 right wrist def random_rotation(J3d): ...
2.5625
3
Desafio Python/Aula 22 des109.py
ayresmajor/Curso-python
0
6383
from des109 import moeda preco = float(input('Digite o preço pretendido: €')) print(f'''A metade do preço é {(moeda.metade(preco))} O dobro do preço é {(moeda.dobra(preco))} Aumentando o preço 10% temos {(moeda.aumentar(preco, 10))} Diminuindo o preço 13% temos {(moeda.aumentar(preco, 13))}''')
3.453125
3
Chapter13_code/ch13_r05_using_the_rpc_api/xmlrpc.py
PacktPublishing/Odoo-Development-Cookbook
55
6384
#!/usr/bin/env python2 import xmlrpclib db = 'odoo9' user = 'admin' password = '<PASSWORD>' uid = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/2/common')\ .authenticate(db, user, password, {}) odoo = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/2/object') installed_modules = odoo.execute_kw( db, ...
2.328125
2
python/zzz/v1-all_feat_cnn/components/features.py
emorynlp/character-identification-old
1
6385
<reponame>emorynlp/character-identification-old<gh_stars>1-10 from abc import * import numpy as np ########################################################### class AbstractFeatureExtractor(object): @abstractmethod def extract(self, object): return ###################################################...
2.46875
2
ufdl-core-app/src/ufdl/core_app/models/mixins/_UserRestrictedQuerySet.py
waikato-ufdl/ufdl-backend
0
6386
from django.db import models class UserRestrictedQuerySet(models.QuerySet): """ Query-set base class for models which apply per-instance permissions based on the user accessing them. """ def for_user(self, user): """ Filters the query-set to those instances that the given u...
2.546875
3
sdk/python/pulumi_azure_native/eventgrid/partner_registration.py
sebtelko/pulumi-azure-native
0
6387
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from...
1.570313
2
_ar/masking_provement.py
TomKingsfordUoA/ResidualMaskingNetwork
242
6388
import os import glob import cv2 import numpy as np import torch from torchvision.transforms import transforms from natsort import natsorted from models import resmasking_dropout1 from utils.datasets.fer2013dataset import EMOTION_DICT from barez import show transform = transforms.Compose( [ transforms.ToPI...
2.375
2
Python/Gerenciador de pagamentos.py
Kauan677/Projetos-Python
1
6389
<gh_stars>1-10 import time import colorama def gerenciador_de_pagamento(): preço = float(str(input('Preço das compras: R$'))) print('''Escolha de pagamento: [ 1 ]A vista dinheiro/cheque: 10% de desconto. [ 2 ]A vista no cartão: 5% de desconto. [ 3 ]Em até duas 2x no cartão: preço formal. [ 4 ]3x...
3.40625
3
src/scs_core/osio/data/abstract_topic.py
seoss/scs_core
3
6390
<gh_stars>1-10 """ Created on 2 Apr 2017 @author: <NAME> (<EMAIL>) """ from collections import OrderedDict from scs_core.data.json import JSONable # -------------------------------------------------------------------------------------------------------------------- class AbstractTopic(JSONable): """ class...
2.1875
2
sdk/python/pulumi_azure_native/notificationhubs/latest/get_namespace.py
pulumi-bot/pulumi-azure-native
0
6391
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
1.570313
2
chue/utils.py
naren-m/chue
0
6392
import json from pygments import highlight from pygments.lexers import JsonLexer from pygments.formatters import TerminalFormatter def print_json_obj(json_object): json_str = json.dumps(json_object, indent=4, sort_keys=True) print(highlight(json_str, JsonLexer(), TerminalFormatter())) def print_json_str(jso...
2.515625
3
selfdrive/car/chrysler/radar_interface.py
919bot/Tessa
85
6393
#!/usr/bin/env python3 import os from opendbc.can.parser import CANParser from cereal import car from selfdrive.car.interfaces import RadarInterfaceBase RADAR_MSGS_C = list(range(0x2c2, 0x2d4+2, 2)) # c_ messages 706,...,724 RADAR_MSGS_D = list(range(0x2a2, 0x2b4+2, 2)) # d_ messages LAST_MSG = max(RADAR_MSGS_C + RA...
2.328125
2
mod/tools/ccmake.py
mattiasljungstrom/fips
429
6394
<gh_stars>100-1000 """ wrapper for ccmake command line tool """ import subprocess name = 'ccmake' platforms = ['linux', 'osx'] optional = True not_found = "required for 'fips config' functionality" #------------------------------------------------------------------------------- def check_exists(fips_dir) : """tes...
1.929688
2
image_quality/handlers/data_generator.py
mbartoli/image-quality-assessment
1
6395
import os import numpy as np import tensorflow as tf from image_quality.utils import utils class TrainDataGenerator(tf.keras.utils.Sequence): '''inherits from Keras Sequence base object, allows to use multiprocessing in .fit_generator''' def __init__(self, samples, img_dir, batch_size, n_classes, basenet_preproc...
2.859375
3
codewars/4 kyu/strip-comments.py
sirken/coding-practice
0
6396
from Test import Test, Test as test ''' Complete the solution so that it strips all text that follows any of a set of comment markers passed in. Any whitespace at the end of the line should also be stripped out. Example: Given an input string of: apples, pears # and bananas grapes bananas !apples The output expecte...
4.125
4
qat/interop/qiskit/quantum_channels.py
myQLM/myqlm-interop
5
6397
# -*- coding: utf-8 -*- """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Versi...
2.09375
2
mne_nirs/simulation/_simulation.py
mshader/mne-nirs
0
6398
<reponame>mshader/mne-nirs # Authors: <NAME> <<EMAIL>> # # License: BSD (3-clause) import numpy as np from mne import Annotations, create_info from mne.io import RawArray def simulate_nirs_raw(sfreq=3., amplitude=1., sig_dur=300., stim_dur=5., isi_min=15., isi_max=45.): ...
2.21875
2
build/lib/dataaccess/TransactionRepository.py
athanikos/cryptodataaccess
0
6399
<gh_stars>0 from cryptomodel.cryptostore import user_notification, user_channel, user_transaction, operation_type from mongoengine import Q from cryptodataaccess import helpers from cryptodataaccess.helpers import if_none_raise, if_none_raise_with_id class TransactionRepository: def __init__(self, config, log_e...
2.265625
2