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 |
|---|---|---|---|---|---|---|
awxkit/test/cli/test_client.py | vrevelas/awx | 0 | 17500 | <reponame>vrevelas/awx<filename>awxkit/test/cli/test_client.py<gh_stars>0
from io import StringIO
import pytest
from requests.exceptions import ConnectionError
from awxkit.cli import run, CLI
class MockedCLI(CLI):
def fetch_version_root(self):
pass
@property
def v2(self):
return Mocked... | 2.3125 | 2 |
tests/python/pants_test/tasks/test_what_changed.py | areitz/pants | 0 | 17501 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import... | 1.632813 | 2 |
utils/image_utils.py | novicasarenac/car-racing-rl | 10 | 17502 | import PIL
import numpy as np
def to_grayscale(img):
return np.dot(img, [0.299, 0.587, 0.144])
def zero_center(img):
return img - 127.0
def crop(img, bottom=12, left=6, right=6):
height, width = img.shape
return img[0: height - bottom, left: width - right]
def save(img, path):
pil_img = PIL.... | 3.015625 | 3 |
sharing_groups/apps.py | sthagen/misp-hub | 2 | 17503 | <gh_stars>1-10
from django.apps import AppConfig
class SharingGroupsConfig(AppConfig):
name = 'sharing_groups'
| 1.179688 | 1 |
GoogleCloud/backend.py | ryanjsfx2424/HowToNFTs | 0 | 17504 | <filename>GoogleCloud/backend.py
## backend.py
"""
The purpose of this script is to continuously monitor the blockchain to
1) determine if a holder aquires or loses an NFT:
2) if they do, generate a new image/movie for the tokens they hold,
3) upload the new image/movie to the hosting service
4) update the metadata fil... | 2.609375 | 3 |
dependencies/pyffi/formats/tga/__init__.py | korri123/fnv-blender-niftools-addon | 4 | 17505 | """
:mod:`pyffi.formats.tga` --- Targa (.tga)
=========================================
Implementation
--------------
.. autoclass:: TgaFormat
:show-inheritance:
:members:
Regression tests
----------------
Read a TGA file
^^^^^^^^^^^^^^^
>>> # check and read tga file
>>> import os
>>> from os.path import dir... | 2.546875 | 3 |
python/push.py | swallowstalker/postopush | 1 | 17506 | import telegram
import os
def main():
token = os.getenv("TOKEN", None)
message = os.getenv("MESSAGE", "No message, please set MESSAGE env")
chat_id = os.getenv("CHAT_ID", None)
bot = telegram.Bot(token=token)
bot.send_message(chat_id=chat_id, text=message, parse_mode=telegram.ParseMode.HTML)
if... | 2.453125 | 2 |
advent-of-code-2018/day 13/main.py | gikf/advent-of-code | 0 | 17507 | <gh_stars>0
"""Advent of Code 2018 Day 13."""
from copy import deepcopy
CARTS = '<>^v'
INTERSECTION = '+'
CURVES = '\\/'
cart_to_direction = {
'<': 180,
'^': 90,
'>': 0,
'v': 270,
}
direction_to_move = {
0: (0, 1),
90: (-1, 0),
180: (0, -1),
270: (1, 0),
}
direction_to_cart = {
0: ... | 3.390625 | 3 |
goopylib/applications/custom_ease.py | YuvrajThorat/goopylib | 0 | 17508 | <reponame>YuvrajThorat/goopylib<filename>goopylib/applications/custom_ease.py
from goopylib.imports import *
from pathlib import Path as pathlib_Path
# I kinda wanted to scrap this, it wasn't that good.
def create_custom_ease():
window = Window(title="goopylib: Create Custom Ease", width=get_screen_size()[1] * 0.7... | 2.375 | 2 |
app/lib/duplication_check/train.py | WHUT-XGP/ASoulCnki | 0 | 17509 | # -*- encoding: utf-8 -*-
"""
Filename :train.py
Description :获取小作文摘要
Time :2021/06/22 15:21:08
Author :hwa
Version :1.0
"""
from app.lib.duplication_check.reply_database import ReplyDatabase
import time
def train_data():
start_time = time.time()
db = ReplyDatabase.... | 2.328125 | 2 |
buildscripts/task_generation/evg_config_builder.py | benety/mongo | 0 | 17510 | """Builder for generating evergreen configuration."""
from threading import Lock
from typing import Set, List, Dict
import inject
from shrub.v2 import ShrubProject, BuildVariant, ExistingTask, Task
from buildscripts.patch_builds.task_generation import validate_task_generation_limit
from buildscripts.task_generation.c... | 1.90625 | 2 |
test/unit/vint/ast/plugin/scope_plugin/stub_node.py | mosheavni/vint | 538 | 17511 | <reponame>mosheavni/vint
from vint.ast.node_type import NodeType
from vint.ast.plugin.scope_plugin.identifier_attribute import (
IDENTIFIER_ATTRIBUTE,
IDENTIFIER_ATTRIBUTE_DYNAMIC_FLAG,
IDENTIFIER_ATTRIBUTE_DECLARATION_FLAG,
IDENTIFIER_ATTRIBUTE_MEMBER_FLAG,
IDENTIFIER_ATTRIBUTE_FUNCTION_FLAG,
I... | 2.125 | 2 |
core/analyser.py | hryu/cpu_usage_analyser | 0 | 17512 | <filename>core/analyser.py
class Analyser:
def __init__(self, callbacks, notifiers, state):
self.cbs = callbacks
self.state = state
self.notifiers = notifiers
def on_begin_analyse(self, timestamp):
pass
def on_end_analyse(self, timestamp):
pass
def analyse(self... | 2.625 | 3 |
grpr2-ch/maci/policies/__init__.py | saarcohen30/GrPR2-CH | 0 | 17513 | <filename>grpr2-ch/maci/policies/__init__.py
from .nn_policy import NNPolicy
# from .gmm import GMMPolicy
# from .latent_space_policy import LatentSpacePolicy
from .uniform_policy import UniformPolicy
# from .gaussian_policy import GaussianPolicy
from .stochastic_policy import StochasticNNPolicy, StochasticNNCondi... | 1.234375 | 1 |
sugarpidisplay/sugarpiconfig/views.py | szpaku80/SugarPiDisplay | 1 | 17514 | """
Routes and views for the flask application.
"""
import os
import json
from flask import Flask, redirect, request, render_template, flash
from pathlib import Path
from flask_wtf import FlaskForm
from wtforms import StringField,SelectField,PasswordField,BooleanField
from wtforms.validators import InputRequired,Valida... | 2.515625 | 3 |
progressao_aritmeticav3.py | eduardobaltazarmarfim/PythonC | 0 | 17515 | def retorno():
resp=input('Deseja executar o programa novamente?[s/n] ')
if(resp=='S' or resp=='s'):
verificar()
else:
print('Processo finalizado com sucesso!')
pass
def cabecalho(titulo):
print('-'*30)
print(' '*9+titulo+' '*15)
print('-'*30)
pass
def mensage... | 4 | 4 |
policies/plc_migrate_default.py | PaloAltoNetworks/pcs-migration-management | 1 | 17516 | <reponame>PaloAltoNetworks/pcs-migration-management
from policies import plc_get, plc_add, plc_update
from sdk.color_print import c_print
from tqdm import tqdm
def migrate_builtin_policies(tenant_sessions: list, logger):
'''
Updates the default/built in policies of all clone tenants so they are the same as the... | 2.140625 | 2 |
MAIN VERSION 2.py | HorridHanu/Notepad-Python | 1 | 17517 | <reponame>HorridHanu/Notepad-Python
########################################################################################
########################################################################################
## # CODE LANGUAGE IS PYHTON! ## ## ##
## # DATE: 1-JU... | 2.484375 | 2 |
unfollow_parfum.py | AntonPukhonin/InstaPy | 0 | 17518 | <filename>unfollow_parfum.py
from instapy import InstaPy
#insta_username = 'antonpuhonin'
#insta_password = '<PASSWORD>'
insta_username = 'tonparfums'
insta_password = '<PASSWORD>'
try:
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser... | 1.960938 | 2 |
portal/grading/serializers.py | LDSSA/portal | 2 | 17519 | <gh_stars>1-10
from rest_framework import serializers
from portal.academy import models
from portal.applications.models import Submission, Challenge
class GradeSerializer(serializers.ModelSerializer):
notebook = serializers.FileField(source="feedback")
class Meta:
model = models.Grade
fields... | 2.25 | 2 |
Funcoes/ex106-sistemaInterativoAjuda.py | ascaniopy/python | 0 | 17520 | <filename>Funcoes/ex106-sistemaInterativoAjuda.py
from time import sleep
c = ('\033[m', # 0 - Sem cores
'\033[0;30;41m', # 1 - Vermelho
'\033[0;30;42m', # 2 - Verde
'\033[0;30;43m', # 3 - Amarelo
'\033[0;30;44m', # 4 - Azul
'\033[0;30;45m', # 5 - Roxo
'\033[0;30m'... | 1.992188 | 2 |
deeptrack/extras/__init__.py | Margon01/DeepTrack-2.0_old | 65 | 17521 | <reponame>Margon01/DeepTrack-2.0_old
from . import datasets, radialcenter | 0.71875 | 1 |
pyvisdk/enums/virtual_machine_ht_sharing.py | Infinidat/pyvisdk | 0 | 17522 |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
VirtualMachineHtSharing = Enum(
'any',
'internal',
'none',
)
| 1.617188 | 2 |
reo/migrations/0118_auto_20210715_2148.py | NREL/REopt_API | 7 | 17523 | <reponame>NREL/REopt_API
# Generated by Django 3.1.12 on 2021-07-15 21:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reo', '0117_auto_20210715_2122'),
]
operations = [
migrations.AddField(
model_name='sitemodel',
... | 1.507813 | 2 |
bpy_lambda/2.78/scripts/addons_contrib/io_scene_cod/__init__.py | resultant-gamedev/bpy_lambda | 0 | 17524 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | 1.703125 | 2 |
pynpact/tests/steps/test_extract.py | NProfileAnalysisComputationalTool/npact | 2 | 17525 | <gh_stars>1-10
import os.path
import pytest
import py
from pynpact.steps import extract
def test_binfile_exists():
assert extract.BIN
assert os.path.exists(extract.BIN)
def test_plan(gbkconfig, executor):
extract.plan(gbkconfig, executor)
filename = gbkconfig[extract.OUTPUTKEY]
assert filename
... | 2.25 | 2 |
dl_training/core.py | Duplums/SMLvsDL | 0 | 17526 | <reponame>Duplums/SMLvsDL<gh_stars>0
# -*- coding: utf-8 -*-
##########################################################################
# NSAp - Copyright (C) CEA, 2019
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/l... | 1.921875 | 2 |
python/two_pointers/1004_max_consecutive_ones_iii.py | linshaoyong/leetcode | 6 | 17527 | from collections import deque
class Solution(object):
def longestOnes(self, A, K):
"""
:type A: List[int]
:type K: int
:rtype: int
"""
start, res = 0, 0
zeros = deque()
for i in range(len(A)):
if A[i] == 0:
zeros.append(i)... | 3.234375 | 3 |
student_files/lap_times_db.py | jstucken/DET-Python-Anki-Overdrive-v1-1 | 0 | 17528 | #
# This script allows the user to control an Anki car using Python
# To control multiple cars at once, open a seperate Command Line Window for each car
# and call this script with the approriate car mac address.
# This script attempts to save lap times into local mysql db running on the pi
# Author: jstucken
#... | 3.25 | 3 |
flatsat/opensatkit/cfs/apps/adcs_io/adcs-drivers/cubewheel-driver/test/code.py | cromulencellc/hackasat-final-2021 | 4 | 17529 | import board
from i2cperipheral import I2CPeripheral
from analogio import AnalogOut
from digitalio import DigitalInOut, Direction, Pull
import struct
import math
import time
regs = [0] * 16
index = 0
i2c_addr = 0x68
frame_id = 0
motor_control_mode = 0
backup_mode = 0
motor_switch_state = 0
hall_switch_state = 0
enc... | 2.53125 | 3 |
constants.py | tooreht/airstripmap | 0 | 17530 | <reponame>tooreht/airstripmap<filename>constants.py
GOV_AIRPORTS = {
"Antananarivo/Ivato": "big",
"Antsiranana/Diego": "small",
"Fianarantsoa": "small",
"Tolagnaro/Ft. Dauphin": "small",
"Mahajanga": "medium",
"Mananjary": "small",
"<NAME>": "medium",
"Morondava": "small",
"<NAME>": ... | 1.429688 | 1 |
practical_0/fibonacci.py | BarracudaPff/code-golf-data-pythpn | 0 | 17531 | <filename>practical_0/fibonacci.py
def fibonacci(n):
fibonacci = np.zeros(10, dtype=np.int32)
fibonacci_pow = np.zeros(10, dtype=np.int32)
fibonacci[0] = 0
fibonacci[1] = 1
for i in np.arange(2, 10):
fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2]
fibonacci[i] = int(fibonacci[i])
print(fibonacci)
for i in... | 3.6875 | 4 |
UW_System/UW_System/UW_System/spiders/uw_system.py | Nouldine/MyCrawlerSystem | 0 | 17532 | <filename>UW_System/UW_System/UW_System/spiders/uw_system.py
from scrapy import Spider
from scrapy.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.linkextractors imp... | 2.046875 | 2 |
src/lib/GL/glutbindings/glutbind.py | kokizzu/v8cgi | 4 | 17533 | <reponame>kokizzu/v8cgi
import sys
import re
PATH_GLUT = 'glut.h'
FILE_GLUT = 'glutbind.cpp'
TEMPLATES = ['glutInit', 'glutTimerFunc']
def main():
"""
Still some things have to be hand-made, like
changing argv pargc values in the glutInit method definition
Also change the TimerFunc method with some ... | 2.5 | 2 |
clase_caballo.py | DorianAlbertoIbanezNanguelu/concurrencia-caballos | 0 | 17534 | import threading
import time
import random
from multiprocessing.pool import ThreadPool
from PyQt5 import QtCore, QtGui, QtWidgets
bandera = False
val1 = ""
msg = 'Caballo ganador es: {}'
# Clase Caballo
class caballo(threading.Thread):
def __init__(self, num, b1,resultado):
global val... | 3.0625 | 3 |
vwo/api/track.py | wingify/vwo-python-sdk | 14 | 17535 | <gh_stars>10-100
# Copyright 2019-2021 Wingify Software Pvt. Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 2.3125 | 2 |
iMessSpam.py | fabiopigi/iMessageSpam | 0 | 17536 | # -*- coding: utf-8 -*-
#import some dope
import sys
import os
import re
import time
from random import randrange
from itertools import repeat
numbers = {
'adam' :"+41111111111",
'bob' :"+41222222222",
'chris' :"+41333333333",
'dave' :"+41444444444",
}
print "Gespeicherte Empfänger: "
for name in numbers:
... | 3.546875 | 4 |
mesh_to_tet.py | NVlabs/deformable_object_grasping | 30 | 17537 | <reponame>NVlabs/deformable_object_grasping
# Copyright (c) 2020 NVIDIA Corporation
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the ri... | 1.835938 | 2 |
tests/policies_tests/test_deterministic_policy.py | xinyuewang1/chainerrl | 2 | 17538 | <gh_stars>1-10
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import unittest
import chainer
import chaine... | 1.8125 | 2 |
freshmaker/handlers/botas/botas_shipped_advisory.py | mulaievaRH/freshmaker | 5 | 17539 | # -*- coding: utf-8 -*-
# Copyright (c) 2020 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | 1.039063 | 1 |
src/masonite/contracts/AuthContract.py | holic-cl/masonite | 95 | 17540 | from abc import ABC as Contract, abstractmethod
class AuthContract(Contract):
@abstractmethod
def user(self):
pass
@abstractmethod
def save(self):
pass
@abstractmethod
def delete(self):
pass
| 2.984375 | 3 |
netblow/bin/netblow_cli.py | viniciusarcanjo/netblow | 8 | 17541 | <filename>netblow/bin/netblow_cli.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""netblow_cli module."""
import argparse
from netblow.netblow import NetBlow
from netblow.version import __version__
def main():
"""Entry function."""
parser = argparse.ArgumentParser(
description="netblo... | 2.5 | 2 |
src/06_tool/regular_expression.py | edgardeng/python-advance-interview | 1 | 17542 | '''
' Python Regular Expression 正则表达式
'
'''
import re
def test_match():
s = 'hello python Hello'
p = 'hello'
o = re.match(p, s)
print(o)
print(dir(o))
print(o.group()) # 返回匹配的字符串
print(o.span()) # 范围
print(o.start()) # 开始处
print('*' * 30, 'flags参数的使用')
o2 = re.match(p, s, re.L)
print(o2.grou... | 3.828125 | 4 |
dot_dotfiles/mail/dot_offlineimap.py | TheRealOne78/dots | 758 | 17543 | #! /usr/bin/env python2
# -*- coding: utf8 -*-
from subprocess import check_output
def get_pass():
return check_output("pass gmail/me", shell=True).strip("\n")
| 2.09375 | 2 |
tests/encoding-utils/test_big_endian_integer.py | carver/ethereum-utils | 0 | 17544 | <gh_stars>0
from __future__ import unicode_literals
import pytest
from hypothesis import (
strategies as st,
given,
)
from eth_utils.encoding import (
int_to_big_endian,
big_endian_to_int,
)
@pytest.mark.parametrize(
'as_int,as_big_endian',
(
(0, b'\x00'),
(1, b'\x01'),
... | 2.421875 | 2 |
src/data/normalization.py | poly-ai/fluid-surface-estimation | 2 | 17545 | <gh_stars>1-10
import numpy as np
# Normalize dataset such that all sequences have min value 0.0, max value 1.0
def normalize(dataset, lower_lim=0.0, upper_lim=1.0):
seq_mins = dataset.min(axis=(1, 2, 3))
seq_maxes = dataset.max(axis=(1, 2, 3))
dataset -= seq_mins.reshape((-1, 1, 1, 1))
dataset /= (... | 2.859375 | 3 |
setup.py | fwitte/PyPSA | 0 | 17546 | <reponame>fwitte/PyPSA
from __future__ import absolute_import
from setuptools import setup, find_packages
from codecs import open
with open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name='pypsa',
version='0.19.1',
author='PyPSA Developers, see https://pypsa.readthedo... | 1.4375 | 1 |
quiz/urls.py | Hysham/Quiz-Hoster | 1 | 17547 | <reponame>Hysham/Quiz-Hoster<filename>quiz/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.quiz_home, name='quiz-home'),
path('page/<int:page_no>/', views.quiz_page, name='quiz-page' ),
path('about/', views.quiz_about, name='quiz-about'),
path('submit/', views.q... | 2.171875 | 2 |
jamf/setconfig.py | pythoninthegrass/python-jamf | 25 | 17548 | <filename>jamf/setconfig.py<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Jamf Config
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (c) 2020 University of Utah, Marriott Library"
__license__ = "MIT"
__version__ = "1.0.4"
import argparse
import getpass
import jamf
im... | 2.546875 | 3 |
src/menuResponse/migrations/0001_initial.py | miguelaav/dev | 0 | 17549 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-12 17:41
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('menuCreate', '0001_initial'),
... | 1.71875 | 2 |
datacube/drivers/s3/storage/s3aio/s3aio.py | Zac-HD/datacube-core | 2 | 17550 | """
S3AIO Class
Array access to a single S3 object
"""
from __future__ import absolute_import
import SharedArray as sa
import zstd
from itertools import repeat, product
import numpy as np
from pathos.multiprocessing import ProcessingPool
from six.moves import zip
try:
from StringIO import StringIO
except Impor... | 2.3125 | 2 |
make_snapshot.py | trquinn/ICgen | 1 | 17551 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 21 15:11:31 2014
@author: ibackus
"""
__version__ = "$Revision: 1 $"
# $Source$
import pynbody
SimArray = pynbody.array.SimArray
import numpy as np
import gc
import os
import isaac
import calc_velocity
import ICgen_utils
import ICglobal_settings
global_settings = ICglo... | 2.34375 | 2 |
diag_rank_update.py | IPA-HD/ldaf_classification | 0 | 17552 | <reponame>IPA-HD/ldaf_classification<gh_stars>0
"""
Diagonal Matrix with rank-1 updates.
"""
import itertools
import torch
from torch.functional import Tensor
class DiagRankUpdate(object):
"""Diagonal Matrix with rank-1 updates"""
def __init__(self, diag, rankUpdates):
super(DiagRankUpdate, self).__in... | 2.25 | 2 |
tests/garage/tf/policies/test_gaussian_mlp_policy_with_model.py | XavierJingfeng/starter | 0 | 17553 | import pickle
from unittest import mock
from nose2.tools.params import params
import numpy as np
import tensorflow as tf
from garage.tf.envs import TfEnv
from garage.tf.policies import GaussianMLPPolicyWithModel
from tests.fixtures import TfGraphTestCase
from tests.fixtures.envs.dummy import DummyBoxEnv
from tests.fi... | 2.21875 | 2 |
cloudify_gcp/monitoring/stackdriver_uptimecheck.py | cloudify-cosmo/cloudify-gcp-plugin | 4 | 17554 | <reponame>cloudify-cosmo/cloudify-gcp-plugin<filename>cloudify_gcp/monitoring/stackdriver_uptimecheck.py<gh_stars>1-10
# #######
# Copyright (c) 2018-2020 Cloudify Platform Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... | 1.929688 | 2 |
tests/test_database.py | penggan666/index_selection_evaluation | 37 | 17555 | <filename>tests/test_database.py
import unittest
from selection.dbms.postgres_dbms import PostgresDatabaseConnector
from selection.index import Index
from selection.table_generator import TableGenerator
from selection.workload import Column, Query, Table
class TestDatabase(unittest.TestCase):
@classmethod
de... | 2.796875 | 3 |
aljson/__init__.py | hrzp/aljson | 1 | 17556 | from sqlalchemy.orm.collections import InstrumentedList
class BaseMixin:
caller_stack = list()
def extract_relations(self):
return self.__mapper__.relationships.keys()
def extract_columns(self):
return self.__mapper__.columns.keys()
def get_columns(self):
result = dict()
... | 2.53125 | 3 |
src/robotide/context/coreplugins.py | veryl-technologies/t24-tests-ide | 1 | 17557 | # Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... | 1.539063 | 2 |
backend/apps/api/system/v1/serializers/groups.py | offurface/smsta | 0 | 17558 | from rest_framework import serializers
from ... import models
class DepartmentSerializers(serializers.ModelSerializer):
"""
Сериализатор кафедр
"""
class Meta:
model = models.Department
fields = ["short_name", "full_name"]
class StudentSerializers(serializers.ModelSerializer):
"... | 2.515625 | 3 |
cinebot_mini/web_utils/blender_client.py | cheng-chi/cinebot_mini | 0 | 17559 | from cinebot_mini import SERVERS
import requests
import numpy as np
import json
def base_url():
blender_dict = SERVERS["blender"]
url = "http://{}:{}".format(
blender_dict["host"], blender_dict["port"])
return url
def handshake():
url = base_url() + "/api/ping"
for i in range(5):
... | 2.96875 | 3 |
gem5-configs/configs-microbench-tests/run_controlbenchmarks.py | TCHERNET/parsec-tests2 | 5 | 17560 | # -*- coding: utf-8 -*-
# Copyright (c) 2018 The Regents of the University of California
# 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 copy... | 1.195313 | 1 |
poezio/args.py | hrnciar/poezio | 0 | 17561 | <filename>poezio/args.py
"""
Module related to the argument parsing
There is a fallback to the deprecated optparse if argparse is not found
"""
from pathlib import Path
from argparse import ArgumentParser, SUPPRESS
from poezio.version import __version__
def parse_args(CONFIG_PATH: Path):
"""
Parse the argum... | 3.21875 | 3 |
src/mist/api/poller/schedulers.py | vladimir-ilyashenko/mist.api | 0 | 17562 | from celerybeatmongo.schedulers import MongoScheduler
from mist.api.sharding.mixins import ShardManagerMixin
from mist.api.poller.models import PollingSchedule
from mist.api.poller.models import OwnerPollingSchedule
from mist.api.poller.models import CloudPollingSchedule
from mist.api.poller.models import MachinePoll... | 2.1875 | 2 |
datasets/hdd_classif.py | valeoai/BEEF | 4 | 17563 | from collections import Counter
import json
from pathlib import Path
from PIL import Image
import numpy as np
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
from bootstrap.lib.logger import Logger
from bootstrap.datasets import transforms as bootstrap_tf
try:... | 2.078125 | 2 |
1W/6/3.py | allenalvin333/Hackerrank_Prep | 2 | 17564 | # https://www.hackerrank.com/challenges/one-week-preparation-kit-jesse-and-cookies/problem
#!/bin/python3
import math
import os
import random
import re
import sys
import heapq
#
# Complete the 'cookies' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# ... | 3.59375 | 4 |
toughio/capillarity/_base.py | keurfonluu/toughio | 21 | 17565 | <filename>toughio/capillarity/_base.py
from abc import ABCMeta, abstractmethod, abstractproperty
import numpy
__all__ = [
"BaseCapillarity",
]
# See <https://stackoverflow.com/questions/35673474/using-abc-abcmeta-in-a-way-it-is-compatible-both-with-python-2-7-and-python-3-5>
ABC = ABCMeta("ABC", (object,), {"__... | 2.90625 | 3 |
gui.py | NejcHirci/material-addon | 4 | 17566 | import bpy
import glob
from bpy.types import Panel, Operator
from bpy.app.handlers import persistent
import os
import threading
from queue import Queue
from pathlib import Path
from . mix_ops import *
from . matgan_ops import *
from . neural_ops import *
cache_path = os.path.join(Path(__file__).parent.resolve(), '.ca... | 2.125 | 2 |
run.py | kbeyer/RPi-LED-SpectrumAnalyzer | 14 | 17567 | """ Main entry point for running the demo. """
# Standard library
import time
import sys
# Third party library
import alsaaudio as aa
# Local library
from char import show_text
from hs_logo import draw_logo
from leds import ColumnedLEDStrip
from music import calculate_levels, read_musicfile_in_chunks, calculate_col... | 2.46875 | 2 |
2020/07/solution.py | dglmoore/advent-of-code | 0 | 17568 | import re
def part1(lines, yourbag="shiny gold"):
# A nice little regex that will extract a list of all bags in a given line.
# The first is the outermost bag, and the rest are inner bags.
pattern = re.compile(r"(?:\d*)\s*(.*?)\s*bags?[.,]?(?: contain)?\s*")
# We're going to use an adjacency list map... | 3.875 | 4 |
src/m6_your_turtles.py | polsteaj/01-IntroductionToPython | 0 | 17569 | <gh_stars>0
"""
Your chance to explore Loops and Turtles!
Authors: <NAME>, <NAME>, <NAME>, <NAME>,
their colleagues and <NAME>.
"""
import rosegraphics as rg
###############################################################################
# DONE: 1.
# On Line 5 above, replace PUT_YOUR_NAME_HERE with your o... | 3.609375 | 4 |
docs/ResearchSession/manage.py | VoIlAlex/pytorchresearch | 1 | 17570 | from backbone import entry_point
if __name__ == '__main__':
entry_point.main()
| 1.078125 | 1 |
base.py | chenzhangyu/WeiboOAuth | 1 | 17571 | # encoding=utf-8
__author__ = 'lance'
import tornado.web
class BaseHandler(tornado.web.RequestHandler):
pass
| 1.421875 | 1 |
paddlers/custom_models/cd/cdnet.py | huilin16/PaddleRS | 40 | 17572 | <filename>paddlers/custom_models/cd/cdnet.py
# Copyright (c) 2022 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... | 2.140625 | 2 |
contrib/make-leap-seconds.py | dmgerman/ntpsec | 0 | 17573 | <filename>contrib/make-leap-seconds.py
#!/usr/bin/env python
"""\
make-leap-seconds.py - make leap second file for testing
Optional args are date of leap second: YYYY-MM-DD
and expiration date of file.
Defaults are start of tomorrow (UTC), and 28 days after the leap.
"Start of tomorow" is as soon as possible for test... | 3.40625 | 3 |
tests/profiling/test_scheduler.py | uniq10/dd-trace-py | 1 | 17574 | <reponame>uniq10/dd-trace-py
# -*- encoding: utf-8 -*-
from ddtrace.profiling import event
from ddtrace.profiling import exporter
from ddtrace.profiling import recorder
from ddtrace.profiling import scheduler
class _FailExporter(exporter.Exporter):
@staticmethod
def export(events):
raise Exception("BO... | 2.078125 | 2 |
scrape_reviews/scrape_reviews/spiders/imdb_spider.py | eshwarkoka/sentiment_analysis_on_movie_reviews | 0 | 17575 | import scrapy,json,re,time,os,glob
from scrapy.exceptions import CloseSpider
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutE... | 2.625 | 3 |
backend/notifications/admin.py | ProgrammingLanguageLeader/TutorsApp | 3 | 17576 | from django.contrib import admin
from notifications.models import Notification
@admin.register(Notification)
class NotificationAdmin(admin.ModelAdmin):
list_display = (
'sender',
'recipient',
'creation_time',
'verb',
'unread',
)
list_filter = (
'sender',
... | 1.6875 | 2 |
logistic-regression/code.py | kalpeshsnaik09/ga-learner-dsmp-repo | 0 | 17577 | # --------------
# import the libraries
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.model_selection import train_test_split
import warnings
warnings.filterwarnings('ignore')
# Code starts here
df=pd.read_csv(path)
print(df.head())
X=df.drop(columns='insuranceclaim')
y=df['insuranceclaim']... | 2.796875 | 3 |
macro_benchmark/SSD_Tensorflow/caffe_to_tensorflow.py | songhappy/ai-matrix | 180 | 17578 | """Convert a Caffe model file to TensorFlow checkpoint format.
Assume that the network built is a equivalent (or a sub-) to the Caffe
definition.
"""
import tensorflow as tf
from nets import caffe_scope
from nets import nets_factory
slim = tf.contrib.slim
# ==========================================================... | 3 | 3 |
setup.py | danihodovic/django-toolshed | 3 | 17579 | <gh_stars>1-10
#!/usr/bin/env python
import os
import re
from setuptools import find_packages, setup
def get_version(*file_paths):
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_... | 1.890625 | 2 |
detection/models/roi_extractors/roi_align.py | waiiinta/object_detection_lab | 13 | 17580 | import tensorflow as tf
from detection.utils.misc import *
class PyramidROIAlign(tf.keras.layers.Layer):
def __init__(self, pool_shape, **kwargs):
'''
Implements ROI Pooling on multiple levels of the feature pyramid.
Attributes
---
pool_shape: (height, width) of the o... | 2.625 | 3 |
examples/simple_regex/routes/__init__.py | nekonoshiri/tiny-router | 0 | 17581 | from ..router import Router
from . import create_user, get_user
router = Router()
router.include(get_user.router)
router.include(create_user.router)
| 1.578125 | 2 |
poetry/packages/constraints/any_constraint.py | vanyakosmos/poetry | 2 | 17582 | <reponame>vanyakosmos/poetry<filename>poetry/packages/constraints/any_constraint.py
from .base_constraint import BaseConstraint
from .empty_constraint import EmptyConstraint
class AnyConstraint(BaseConstraint):
def allows(self, other):
return True
def allows_all(self, other):
return True
... | 2.59375 | 3 |
lib/rucio/db/sqla/migrate_repo/versions/22d887e4ec0a_create_sources_table.py | brianv0/rucio | 0 | 17583 | <reponame>brianv0/rucio
# Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
#... | 1.890625 | 2 |
algorithms/FdGars/FdGars_main.py | ss1004124654/DGFraud-TF2 | 51 | 17584 | <reponame>ss1004124654/DGFraud-TF2
"""
This code is attributed to <NAME> (@YingtongDou) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection in TensorFlow 2.X)
https://github.com/safe-graph/DGFraud-TF2
"""
import argparse
import numpy as np
from tqdm import tqdm
import tensorflow as tf
from tensor... | 2.375 | 2 |
problem3a.py | mvignoul/phys218_example | 0 | 17585 | """ find the Schwarzschild radius of the Sun in m using pint"""
import pint
class Sun:
""" Class to describe a star based on its mass in terms of solar masses """
def __init__(self, mass):
self.ureg = pint.UnitRegistry()
self.ureg.define("Msolar = 1.98855*10**30 * kilogram")
self.mass ... | 3.65625 | 4 |
morpfw/authn/pas/user/rulesprovider.py | morpframework/morpfw | 8 | 17586 | from ....crud.rulesprovider.base import RulesProvider
from .. import exc
from ..app import App
from ..utils import has_role
from .model import UserCollection, UserModel
class UserRulesProvider(RulesProvider):
context: UserModel
def change_password(self, password: str, new_password: str, secure: bool = True)... | 2.125 | 2 |
dsa_extras/library/codec_code/huffman.py | palette-swapped-serra/dsa-extras | 1 | 17587 | from dsa.parsing.line_parsing import line_parser
from dsa.parsing.token_parsing import make_parser
_parser = line_parser(
'Huffman table entry',
make_parser(
'Huffman table entry data',
('integer', 'encoded bit sequence'),
('hexdump', 'decoded bytes')
)
)
class Huff... | 2.953125 | 3 |
src/fake_news_detector/core/data_process/exploration.py | elena20ruiz/FNC | 4 | 17588 | def split_in_three(data_real, data_fake):
min_v = min(data_fake.min(), data_real.min())
max_v = max(data_fake.max(), data_real.max())
tercio = (max_v - min_v) / 3
# Calculate 1/3
th_one = min_v + tercio
# Calculate 2/3
th_two = max_v - tercio
first_f, second_f, third_f = split_data(th_... | 3.71875 | 4 |
evap/evaluation/tests/test_auth.py | Sohn123/EvaP | 0 | 17589 | <gh_stars>0
from unittest.mock import patch
import urllib
from django.urls import reverse
from django.core import mail
from django.conf import settings
from django.test import override_settings
from model_bakery import baker
from evap.evaluation import auth
from evap.evaluation.models import Contribution, Evaluation... | 2.078125 | 2 |
gwd/converters/spike2kaggle.py | kazakh-shai/kaggle-global-wheat-detection | 136 | 17590 | import argparse
import os.path as osp
from glob import glob
import cv2
import pandas as pd
from tqdm import tqdm
from gwd.converters import kaggle2coco
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--image-pattern", default="/data/SPIKE_images/*jpg")
parser.add_argument("--an... | 2.515625 | 3 |
shuttl/tests/test_views/test_organization.py | shuttl-io/shuttl-cms | 2 | 17591 | <gh_stars>1-10
import json
from shuttl import app
from shuttl.tests import testbase
from shuttl.Models.Reseller import Reseller
from shuttl.Models.organization import Organization, OrganizationDoesNotExistException
class OrganizationViewTest(testbase.BaseTest):
def _setUp(self):
pass
def test_index(s... | 2.296875 | 2 |
emissary/controllers/load.py | LukeB42/Emissary | 193 | 17592 | <gh_stars>100-1000
# This file contains functions designed for
# loading cron tables and storing new feeds.
from emissary import db
from sqlalchemy import and_
from emissary.controllers.utils import spaceparse
from emissary.controllers.cron import parse_timings
from emissary.models import APIKey, Feed, FeedGroup
def ... | 2.640625 | 3 |
vodgen/main.py | Oveof/Vodgen | 0 | 17593 | <reponame>Oveof/Vodgen
"""Vodgen app"""
from msilib.schema import Directory
import sys
import json
import re
from PyQt5.QtWidgets import (QApplication, QCheckBox, QComboBox,
QFileDialog, QLabel, QLineEdit, QMainWindow, QPlainTextEdit, QPushButton, QVBoxLayout, QWidget)
from videocutter import create_video
from thum... | 2.609375 | 3 |
bin/plpproject.py | stefanct/pulp-tools | 2 | 17594 | <gh_stars>1-10
#
# Copyright (C) 2018 ETH Zurich and University of Bologna
#
# 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 requi... | 2.15625 | 2 |
leetcode/268_missing_number/268_missing_number.py | ryangillard/misc | 0 | 17595 | <filename>leetcode/268_missing_number/268_missing_number.py<gh_stars>0
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums_set = set(nums)
full_length = len(nums) + 1
for num in range(full_length):
... | 3.59375 | 4 |
tests/shell/test_console.py | svidoso/ipopo | 65 | 17596 | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the shell console
:author: <NAME>
"""
# Pelix
from pelix.utilities import to_str, to_bytes
# Standard library
import random
import string
import sys
import threading
import time
# Tests
try:
import unittest2 as unittest
except ImportError:
impo... | 2.4375 | 2 |
src/util/utils.py | 5agado/intro-ai | 3 | 17597 | <filename>src/util/utils.py<gh_stars>1-10
import os
import math
def dotProduct(v1, v2):
return sum(x * y for x, y in zip(v1, v2))
def sigmoid(x):
return 1.0 / (1.0 + math.exp(-x))
def getResourcesPath():
return os.path.abspath(os.path.join(os.path.dirname( __file__ ), os.pardir, 'resour... | 2.484375 | 2 |
scripts/models/xgboost/test-xgboost_tuning3.py | jmquintana79/utilsDS | 0 | 17598 | <gh_stars>0
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2018-09-26 10:01:02
# @Last Modified by: <NAME>
# @Last Modified time: 2018-09-26 16:04:24
"""
XGBOOST Regressor with Bayesian tuning: OPTION 3
In this case it will be used hyperopt-sklearn and his native algorithm
"xgboost_regression".
NOTE: scikit-... | 2.578125 | 3 |
EstruturaDeRepeticao/exercicio32.py | Nicolas-Wursthorn/exercicios-python-brasil | 0 | 17599 | <filename>EstruturaDeRepeticao/exercicio32.py
# O Departamento Estadual de Meteorologia lhe contratou para desenvolver um programa que leia as um conjunto indeterminado de temperaturas, e informe ao final a menor e a maior temperaturas informadas, bem como a média das temperaturas.
temperaturas = []
while True:
g... | 3.90625 | 4 |