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 |
|---|---|---|---|---|---|---|
src/ralph/api/__init__.py | DoNnMyTh/ralph | 1,668 | 22300 | from ralph.api.serializers import RalphAPISerializer
from ralph.api.viewsets import RalphAPIViewSet, RalphReadOnlyAPIViewSet
from ralph.api.routers import router
__all__ = [
'RalphAPISerializer',
'RalphAPIViewSet',
'RalphReadOnlyAPIViewSet',
'router',
]
| 1.375 | 1 |
demo_odoo_tutorial_wizard/models/models.py | digitalsatori/odoo-demo-addons-tutorial | 57 | 22301 | from odoo import models, fields, api
from odoo.exceptions import ValidationError
class DemoOdooWizardTutorial(models.Model):
_name = 'demo.odoo.wizard.tutorial'
_description = 'Demo Odoo Wizard Tutorial'
name = fields.Char('Description', required=True)
partner_id = fields.Many2one('res.partner', strin... | 2.5 | 2 |
eaa_donations/donations/models/partner_charity.py | andrewbird2/eaa_donations | 0 | 22302 | from django.db import models
class PartnerCharity(models.Model):
slug_id = models.CharField(max_length=30, unique=True)
name = models.TextField(unique=True, verbose_name='Name (human readable)')
email = models.EmailField(help_text='Used to cc the charity on receipts')
xero_account_name = models.TextFi... | 2.171875 | 2 |
python_data_utils/spark/ml/lightgbm.py | surajiyer/python-data-utils | 4 | 22303 | __all__ = ['LightGBMRegressorModel']
from mmlspark.lightgbm.LightGBMRegressor import LightGBMRegressor, LightGBMRegressionModel
from mmlspark.train import ComputeModelStatistics
from pyspark.ml.evaluation import RegressionEvaluator
from pyspark.sql import DataFrame
import pyspark.sql.functions as F
from python_data_u... | 2.265625 | 2 |
UDTherapy/__init__.py | JonSn0w/Urban-Dictionary-Therapy | 3 | 22304 | <gh_stars>1-10
name = 'Urban Dictionary Therapy'
__all__ = ['UDTherapy',
'helper']
| 1.125 | 1 |
torch-test/mpich-3.4.3/modules/libfabric/contrib/intel/jenkins/runtests.py | alchemy315/NoPFS | 0 | 22305 | import argparse
import os
import sys
sys.path.append(os.environ['CI_SITE_CONFIG'])
import ci_site_config
import run
import common
parser = argparse.ArgumentParser()
parser.add_argument("--prov", help="core provider", choices=["psm2", "verbs", \
"tcp", "udp", "sockets", "shm"])
parser.add_argument... | 2.109375 | 2 |
interview_kickstart/01_sorting_algorithms/class_discussed_problems/python/0075_sort_colors.py | mrinalini-m/data_structures_and_algorithms | 2 | 22306 | from typing import List
def swap(arr, i, j):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
low = 0
high = len(nums) - 1
i = 0
... | 3.953125 | 4 |
bnpy/data/GroupXData.py | raphael-group/bnpy | 184 | 22307 | <reponame>raphael-group/bnpy<filename>bnpy/data/GroupXData.py
'''
Classes
-----
GroupXData
Data object for holding a dense matrix X of real 64-bit floats,
organized contiguously based on provided group structure.
'''
import numpy as np
from collections import namedtuple
from bnpy.data.XData import XData
from b... | 3.109375 | 3 |
sghymnal/users/models.py | shortnd/sghymnal | 0 | 22308 | <filename>sghymnal/users/models.py<gh_stars>0
from django.contrib.auth.models import AbstractUser
from django.db.models import BooleanField, CharField
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
class User(AbstractUser):
# First Name and Last Name do not cover name pat... | 2.21875 | 2 |
GNetLMM/pycore/mtSet/linalg/linalg_matrix.py | PMBio/GNetLMM | 4 | 22309 | <reponame>PMBio/GNetLMM
"""Matrix linear algebra routines needed for GP models"""
import scipy as SP
import scipy.linalg as linalg
import logging
def solve_chol(A,B):
"""
Solve cholesky decomposition::
return A\(A'\B)
"""
# X = linalg.solve(A,linalg.solve(A.transpose(),B))
# much... | 2.9375 | 3 |
WebDev/Task 3/we-poll/flaskapp/main.py | vigneshd332/delta-inductions-2021-master | 0 | 22310 | <reponame>vigneshd332/delta-inductions-2021-master
import ast
from flask import Flask, request
from flaskext.mysql import MySQL
from flask_cors import CORS, cross_origin
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
mysql=MySQL()
app.config['MYSQL_DATABASE_USER'] = 'admin'
app.con... | 2.578125 | 3 |
src/models/participants/participants.py | jfblg/Tracktime-UZE | 0 | 22311 | from wtforms import Form, BooleanField, IntegerField, StringField, PasswordField, validators
from wtforms.fields.html5 import EmailField
from src.common.database import db
from sqlalchemy import exc
class RunnerRegistrationForm(Form):
first_name = StringField('First name', [
validators.Length(min=2, max=... | 2.671875 | 3 |
demo.py | ruixuantan/FourParts | 0 | 22312 | import fourparts as fp
import pandas as pd
file_name = 'chorale_F'
df = fp.midi_to_df('samples/' + file_name + '.mid', save=True)
chords = fp.PreProcessor(4).get_progression(df)
chord_progression = fp.ChordProgression(chords)
# gets pitch class sets
pitch_class_sets = chord_progression.get_pitch_class_sets()
pd.Dat... | 2.71875 | 3 |
jenkins_status.py | tektronix/obsidian | 2 | 22313 | <gh_stars>1-10
#!/usr/bin/env python3
# Display a Jenkins build job status and progress
# Re-use animation functions from https://github.com/jgarff/rpi_ws281x/blob/master/python/examples/strandtest.py
import argparse
import random
import sys
import datetime
import time
from rpi_ws281x import Adafruit_NeoPixel, Color... | 2.53125 | 3 |
RQ1_RQ2/Thermostat_case_study/EVALUATION/Pymoo_GA/MyTcMutation.py | dgumenyuk/Environment_generation | 0 | 22314 | <filename>RQ1_RQ2/Thermostat_case_study/EVALUATION/Pymoo_GA/MyTcMutation.py
import numpy as np
from pymoo.model.mutation import Mutation
import copy
import config as cf
import random as rm
class MyTcMutation(Mutation):
def __init__(self):
super().__init__()
def _do(self, problem, X, **kwargs):
... | 2.46875 | 2 |
yufeng_code/models.py | BrandonThaiTran/stressed_emotion | 0 | 22315 | """
Defines models
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence
from torch.nn.utils.rnn import pad_packed_sequence
def init_weights(m):
if type(m) == nn.Linear or ... | 2.578125 | 3 |
intercom/api_operations/find.py | orikalinski/python-intercom | 0 | 22316 | <reponame>orikalinski/python-intercom<filename>intercom/api_operations/find.py<gh_stars>0
# -*- coding: utf-8 -*-
"""Operation to find an instance of a particular resource."""
from intercom import HttpError
from intercom import utils
class Find(object):
"""A mixin that provides `find` functionality."""
def ... | 2.75 | 3 |
Python/maximum-number-of-occurrences-of-a-substring.py | RideGreg/LeetCode | 1 | 22317 | # Time: O(n)
# Space: O(n)
# 1297 weekly contest 168 12/21/2019
# Given a string s, return the maximum number of ocurrences of any substring under the following rules:
#
# The number of unique characters in the substring must be less than or equal to maxLetters.
# The substring size must be between minSize and maxSi... | 3.25 | 3 |
source/protocol/image_0203_protocol.py | chopin1993/protocolmaster-20210731 | 0 | 22318 | <filename>source/protocol/image_0203_protocol.py
# encoding:utf-8
from .protocol import Protocol
from .protocol import find_head
from .codec import BinaryEncoder
from tools.converter import hexstr2bytes, str2hexstr
from .data_container import *
import time
import struct
from protocol.data_container import DataStruct
IM... | 2.796875 | 3 |
ucscsdk/methodmeta/ConfigUCEstimateImpactMeta.py | parag-may4/ucscsdk | 9 | 22319 | """This module contains the meta information of ConfigUCEstimateImpact ExternalMethod."""
from ..ucsccoremeta import MethodMeta, MethodPropertyMeta
method_meta = MethodMeta("ConfigUCEstimateImpact", "configUCEstimateImpact", "Version142b")
prop_meta = {
"cookie": MethodPropertyMeta("Cookie", "cookie", "Xs:string... | 1.8125 | 2 |
src/midiutil/midiosc.py | neonkingfr/VizBench | 7 | 22320 | """
This module provides an interface to MIDI things for OSC
"""
import sys
import time
import traceback
import thread
import threading
import copy
import string
import re
from threading import Thread,Lock
from math import sqrt
from ctypes import *
from time import sleep
from traceback import format_exc
from array im... | 2.4375 | 2 |
argentum-api/api/tests/test_guest_view.py | devium/argentum | 1 | 22321 | import copy
import logging
from api.models import Transaction, BonusTransaction, Order, Tag, OrderItem
from api.models.guest import Guest
from api.models.label import Label
from api.tests.data.guests import TestGuests
from api.tests.data.statuses import TestStatuses
from api.tests.data.users import TestUsers
from api.... | 2.109375 | 2 |
nonebot/adapters/qqguild/message.py | nonebot/adapter-qqguild | 39 | 22322 | import re
from typing import Any, Type, Tuple, Union, Iterable
from nonebot.typing import overrides
from nonebot.adapters import Message as BaseMessage
from nonebot.adapters import MessageSegment as BaseMessageSegment
from .utils import escape, unescape
from .api import Message as GuildMessage
from .api import Messa... | 2.171875 | 2 |
creme/metrics/__init__.py | Raul9595/creme | 1 | 22323 | """
A set of metrics used in machine learning that can be computed in a streaming fashion, without any
loss in precision.
"""
from .accuracy import Accuracy
from .accuracy import RollingAccuracy
from .confusion import ConfusionMatrix
from .confusion import RollingConfusionMatrix
from .cross_entropy import CrossEntropy
... | 2.015625 | 2 |
cd/checks/is_player_connected.py | Axelware/CD-bot | 2 | 22324 | # Future
from __future__ import annotations
# Standard Library
from collections.abc import Callable
from typing import Literal, TypeVar
# Packages
from discord.ext import commands
# Local
from cd import custom, exceptions
__all__ = (
"is_player_connected",
)
T = TypeVar("T")
def is_player_connected() -> Ca... | 2.46875 | 2 |
src/test/base.py | vincent-lg/levantine | 0 | 22325 | """Base test for TalisMUD tests.
It creates an in-memory database for each test, so they run in independent
environments.
"""
import unittest
from pony.orm import db_session
from data.base import db
from data.properties import LazyPropertyDescriptor
# Bind to a temporary database
db.bind(provider="sqlite", filena... | 2.578125 | 3 |
setup.py | zkbt/henrietta | 0 | 22326 | <gh_stars>0
'''
This setup.py file sets up our package to be installable on any computer,
so that folks can `import henrietta` from within any directory.
Thanks to this file, you can...
...tell python to look for `henrietta` in the current directory (which you
can continue to edit), by typing *one* of the following c... | 1.976563 | 2 |
zedenv/plugins/systemdboot.py | slicer69/zedenv | 0 | 22327 | <reponame>slicer69/zedenv
import shutil
import os
import re
import tempfile
import click
import zedenv.lib.be
import zedenv.plugins.configuration as plugin_config
import zedenv.lib.system
from zedenv.lib.logger import ZELogger
class SystemdBoot:
systems_allowed = ["linux"]
bootloader = "systemdboot"
d... | 1.953125 | 2 |
dockerfile/web/mailman-web/main.py | TommyLike/kubernetes-mailman | 0 | 22328 | <filename>dockerfile/web/mailman-web/main.py
import os
import socket
import ipaddress
DEBUG = True
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# NOTE: this is the MTA host, we need to update it.
EMAIL_HOST = 'mailman-exim4-0.mail-suit-service.default.svc.cluster.local'
EMAIL_PORT = 25
mailman_ip_ad... | 1.96875 | 2 |
mask_functions.py | jhh37/wearmask3d | 6 | 22329 | <gh_stars>1-10
# WearMask3D
# Copyright 2021 <NAME> and <NAME>. All rights reserved.
# http://github.com/jhh37/wearmask3d
#
# 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... | 1.515625 | 2 |
adminapp/admin.py | gabyxbinnaeah/Bus-Booking | 0 | 22330 | <reponame>gabyxbinnaeah/Bus-Booking<filename>adminapp/admin.py
from django.contrib import admin
from .models import Admin, Profile
# from userapp.models import Book
# from driverapp.models import Bus
admin.site.register(Admin)
admin.site.register(Profile)
# admin.site.register(Bus)
# admin.site.register(Book) | 1.484375 | 1 |
zstackwoodpecker/zstackwoodpecker/operations/hybrid_operations.py | bgerxx/woodpecker | 0 | 22331 | '''
All ldap operations for test.
@author: quarkonics
'''
from apibinding.api import ApiError
import apibinding.inventory as inventory
import apibinding.api_actions as api_actions
import zstackwoodpecker.test_util as test_util
import account_operations
import config_operations
import os
import inspec... | 1.875 | 2 |
datasets_example/populate_elastic.py | aleksbobic/csx | 0 | 22332 | import requests
import sys
requests.put(f"http://localhost:9200/{sys.argv[1]}?pretty")
headers = {"Content-Type": "application/x-ndjson"}
data = open(sys.argv[2], "rb").read()
requests.post(
f"http://localhost:9200/{sys.argv[1]}/_bulk?pretty", headers=headers, data=data
)
| 2.515625 | 3 |
numba/cuda/simulator/cudadrv/error.py | auderson/numba | 6,620 | 22333 | class CudaSupportError(RuntimeError):
pass
| 1.148438 | 1 |
tests/unit/utils/test_attributes.py | pyqgis/plutil | 0 | 22334 | <reponame>pyqgis/plutil<gh_stars>0
# -*- coding: utf-8 -*-
"""
Unit tests for Attributes.
"""
from __future__ import unicode_literals
from __future__ import print_function
import logging
import os
import shutil
import tempfile
from unittest import TestCase, SkipTest
from unittest.mock import MagicMock
from qgis.PyQt.... | 2.21875 | 2 |
portal/template.py | SlapBass/nx-portal | 5 | 22335 | from django.conf import settings
def shared_view_contexts(request):
return {
'APP_NAME': settings.APPLICATION_NAME,
'SEASONABLE_EMOJI': settings.SEASONABLE_EMOJI,
}
| 1.476563 | 1 |
app.py | Tesfa-eth/online_book_store | 0 | 22336 | from enum import unique
from typing import Reversible
from flask import Flask, app, render_template, url_for, redirect, request
#import flask
from flask.helpers import flash
from flask_login.utils import login_fresh
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin, login_manager, login_user, Lo... | 2.671875 | 3 |
aei_net.py | ilyakava/faceshifter | 0 | 22337 | import torch
import torch.nn.functional as F
from torch.optim import Adam
from torch.utils.data import DataLoader
import torchvision
from torchvision import transforms
from torchvision.models import resnet101
import pytorch_lightning as pl
from model.AEINet import ADDGenerator, MultilevelAttributesEncoder
from model... | 2.09375 | 2 |
luna/gateware/usb/usb3/link/timers.py | macdaliot/luna | 2 | 22338 | <reponame>macdaliot/luna
#
# This file is part of LUNA.
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
""" U0 link-maintenance timers. """
from nmigen import *
class LinkMaintenanceTimers(Elaboratable):
""" Timers which ensure link integrity is maintained in U0.
These timers... | 2.484375 | 2 |
S4/S4 Library/simulation/ensemble/ensemble_interactions.py | NeonOcean/Environment | 1 | 22339 | <reponame>NeonOcean/Environment<filename>S4/S4 Library/simulation/ensemble/ensemble_interactions.py
from objects.base_interactions import ProxyInteraction
from sims4.utils import classproperty, flexmethod
class EnsembleConstraintProxyInteraction(ProxyInteraction):
INSTANCE_SUBCLASSES_ONLY = True
@classpropert... | 2.109375 | 2 |
setup.py | ryderdamen/phonetic-alphabet | 3 | 22340 | <filename>setup.py
import setuptools
def get_readme():
with open('README.md') as f:
return f.read()
INSTALL_REQUIRES = []
TESTS_REQUIRE = ['pytest']
setuptools.setup(
name='phonetic_alphabet',
version='0.1.0',
description='Convert characters and digits to phonetic alphabet equivalents.',
... | 1.523438 | 2 |
tests/fixtures.py | vfxetc/sgcache | 13 | 22341 | <reponame>vfxetc/sgcache
from . import uuid
def task_crud(self, shotgun, trigger_poll=lambda: None):
shot_name = uuid(8)
shot = shotgun.create('Shot', {'code': shot_name})
name = uuid(8)
task = shotgun.create('Task', {'content': name, 'entity': shot})
trigger_poll()
x = self.cached.find_one... | 2.1875 | 2 |
config.py | ricsonc/aptools | 1 | 22342 | <gh_stars>1-10
from munch import Munch as M
cores = 20
demosaic_params = M(
# at most one of use_flat or use_lens_profile should be True
# strongly recommended to have at least 1 be True
use_flat = False,
use_lens_profile = True,
alg = 'DCB', #alternatively, use LMMSE
camera = 'auto', # alter... | 1.960938 | 2 |
src/cogs/ide/dialogs/navigated_saved.py | boopdev/Jarvide | 0 | 22343 | <reponame>boopdev/Jarvide
import disnake
import time
from disnake.ext import commands
from typing import Optional
from odmantic import Model
from src.utils import ExitButton, EmbedFactory, File, get_info
class FileModel(Model): # noqa
user_id: int
name: str
file_url: Optional[str] = None
folder: Op... | 2.109375 | 2 |
BiBloSA/exp_SICK/src/evaluator.py | mikimaus78/ml_monorepo | 116 | 22344 | from configs import cfg
from src.utils.record_log import _logger
import numpy as np
import tensorflow as tf
import scipy.stats as stats
class Evaluator(object):
def __init__(self, model):
self.model = model
self.global_step = model.global_step
## ---- summary----
self.build_summar... | 2.265625 | 2 |
pytorch_translate/tasks/translation_from_pretrained_xlm.py | dzhulgakov/translate | 748 | 22345 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same dire... | 2.28125 | 2 |
drugresnet/seya/layers/memnn2.py | Naghipourfar/CCLE | 429 | 22346 | <gh_stars>100-1000
import theano.tensor as T
import keras.backend as K
from keras.layers.core import LambdaMerge
from keras import initializations
class MemN2N(LambdaMerge):
def __init__(self, layers, output_dim, input_dim, input_length,
memory_length, hops=3, bow_mode="bow", mode="adjacent",
... | 2.421875 | 2 |
nyan/utils/io.py | TWRogers/nyan | 2 | 22347 | <gh_stars>1-10
import cv2
from PIL import Image
import os
import numpy as np
IMAGE_BE = os.environ.get('NYAN_IMAGE_BE', 'PIL')
if IMAGE_BE == 'PIL':
def IMREAD_FN(x):
return np.array(Image.open(x).convert('RGB')).astype(np.uint8)
elif IMAGE_BE == 'cv2':
def IMREAD_FN(x):
return cv2.imread(x)... | 2.890625 | 3 |
src/server.py | sqweelygig/a-pi-api | 0 | 22348 | import RPi.GPIO as GPIO
import connexion
if __name__ == '__main__':
app = connexion.App('a-pi-api')
app.add_api('v0/spec.yml')
app.run(host='0.0.0.0', port=80)
| 2.078125 | 2 |
detect_fraud_email_enron/tools/k_best_selector.py | gotamist/other_machine_learning | 0 | 22349 | <gh_stars>0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 25 18:26:45 2018
@author: gotamist
"""
import sys
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
from sklearn.feature_selection import SelectKBest
def KBestSelector(data_dict, features_list, k):... | 2.5 | 2 |
Python/179.py | jaimeliew1/Project_Euler_Solutions | 0 | 22350 | # -*- coding: utf-8 -*-
"""
Solution to Project Euler problem 179 - Consecutive positive divisors
Author: <NAME>
https://github.com/jaimeliew1/Project_Euler_Solutions
"""
def run():
N = int(1e7)
n_factors = [1 for _ in range(N + 1)]
# can start at 2 because 1 is a divisor for all numbers and wont chang... | 3.5625 | 4 |
tweetx/environment.py | Druid-of-Luhn/TweetX | 0 | 22351 | <gh_stars>0
#!/usr/bin/env python3
import asyncio, entity, io, json, logging, queue, random, threading, time, websockets, whale
from bot import bot
from random import randrange
logging.basicConfig()
log = logging.getLogger('tweetx')
log.setLevel(logging.DEBUG)
class Event:
def __init__(self):
self.callba... | 2.78125 | 3 |
retired/example_process_discharge_simulation.py | changliao1025/pyswat | 2 | 22352 | <reponame>changliao1025/pyswat
from swaty.simulation.swat_main import swat_main
from swaty.swaty_read_model_configuration_file import swat_read_model_configuration_file
from swaty.classes.pycase import swaty
from swaty.postprocess.extract.swat_extract_stream_discharge import swat_extract_stream_discharge
sFilename_con... | 1.664063 | 2 |
ThinkPython/chap9/ex9.py | sokolowskik/Tutorials | 0 | 22353 | <gh_stars>0
def is_reverse(i, j):
"""
Convert 2-digit numbers to strings and check if they are palindromic.
If one of the numbers has less then 2 digits, fill with zeros.
"""
str_i = str(i)
str_j = str(j)
if len(str_i) < 2:
str_i = str_i.zfill(2)
if len(str_j) < 2:
str_j ... | 4.03125 | 4 |
Segnet/训练.py | 1044197988/- | 186 | 22354 | #coding=utf-8
import matplotlib
matplotlib.use("Agg")
import tensorflow as tf
import argparse
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D,MaxPooling2D,UpSampling2D,BatchNormalization,Reshape,Permute,Activation
from tensorflow.keras.utils imp... | 2.359375 | 2 |
Python/295. FindMedianFromDataStream.py | nizD/LeetCode-Solutions | 263 | 22355 | <reponame>nizD/LeetCode-Solutions<filename>Python/295. FindMedianFromDataStream.py<gh_stars>100-1000
"""
Problem:
--------
Design a data structure that supports the following two operations:
- `void addNum(int num)`: Add a integer number from the data stream to the data structure.
- `double findMedian()`: Return the ... | 3.5625 | 4 |
openproblems/data/human_blood_nestorowa2016.py | bendemeo/SingleCellOpenProblems | 134 | 22356 | from . import utils
import os
import scanpy as sc
import scprep
import tempfile
URL = "https://ndownloader.figshare.com/files/25555751"
@utils.loader
def load_human_blood_nestorowa2016(test=False):
"""Download Nesterova data from Figshare."""
if test:
# load full data first, cached if available
... | 2.609375 | 3 |
jskparser/ast/stmt/ifstmt.py | natebragg/java-sketch | 15 | 22357 | #!/usr/bin/env python
from .statement import Statement
from . import _import
class IfStmt(Statement):
def __init__(self, kwargs={}):
super(IfStmt, self).__init__(kwargs)
locs = _import()
# Expression condition;
con = kwargs.get(u'condition', {})
self._condition = locs... | 2.484375 | 2 |
stdpages/profiling.py | nhartland/dashengine | 12 | 22358 | <filename>stdpages/profiling.py
""" Page for the monitoring of query performance characteristics. """
import json
# Plotly
import plotly.graph_objs as go
# Dash
import dash_table as dt
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
# DashEngine
from... | 2.578125 | 3 |
trial_inputs_pb2.py | adeandrade/bayesian-optimizer | 0 | 22359 | <reponame>adeandrade/bayesian-optimizer<filename>trial_inputs_pb2.py<gh_stars>0
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: trial_inputs.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google... | 1.5625 | 2 |
neutron_plugin_contrail/plugins/opencontrail/vnc_client/router_res_handler.py | alexelshamouty/tf-neutron-plugin | 3 | 22360 | <reponame>alexelshamouty/tf-neutron-plugin
# Copyright 2015. 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-... | 1.664063 | 2 |
src/screenlogger.py | swbooking/RobotMaria | 0 | 22361 | <gh_stars>0
class ScreenLogger:
def __init__(self, loghandler=None, verbose = True):
self.LogMessage = None
self.LogHandler = loghandler
self.Verbose = verbose
return
def Log(self, message):
if self.LogMessage != message:
self.LogMessage = message
... | 2.875 | 3 |
ffmpeg-3.2.5/tools/zmqshell.py | huyu0415/FFmpeg | 3,645 | 22362 | <gh_stars>1000+
#!/usr/bin/env python2
import sys, zmq, cmd
class LavfiCmd(cmd.Cmd):
prompt = 'lavfi> '
def __init__(self, bind_address):
context = zmq.Context()
self.requester = context.socket(zmq.REQ)
self.requester.connect(bind_address)
cmd.Cmd.__init__(self)
def onecm... | 2.5 | 2 |
minidoc/minidoc.py | ihgazni2/minidoc | 0 | 22363 | from minidoc import svg
from minidoc import tst
from efdir import fs
import shutil
import os
def creat_one_svg(k,v,i=None,**kwargs):
if("dst_dir" in kwargs):
dst_dir = kwargs['dst_dir']
else:
dst_dir = "./images"
screen_size = svg.get_screen_size(v,**kwargs)
kwargs['screen_size'] = scre... | 2.515625 | 3 |
qinhaifang/src/evalTools/script/convert_label_map_to_geojson.py | SpaceNetChallenge/BuildingFootprintDetectors | 161 | 22364 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding=gbk
"""
Convert mask to geojson format
"""
import os
import os.path
import re
import logging
import logging.config
from multiprocessing import Pool
import skimage.io as sk
import numpy as np
import scipy.io as sio
import setting
from spaceNet import geoTools as gT
... | 1.710938 | 2 |
core/migrations/0008_touristspot_photo.py | isnardsilva/django-attractions-api | 1 | 22365 | # Generated by Django 3.0.7 on 2020-07-19 03:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20200614_0254'),
]
operations = [
migrations.AddField(
model_name='touristspot',
name='photo',
... | 1.539063 | 2 |
tests/integration/test_user_invite.py | donovan-PNW/dwellinglybackend | 15 | 22366 | <gh_stars>10-100
import pytest
from models.user import RoleEnum
from unittest.mock import patch
from resources.email import Email
@pytest.mark.usefixtures("client_class", "empty_test_db")
class TestUserInvite:
def setup(self):
self.endpoint = "/api/user/invite"
@patch.object(Email, "send_user_invite_... | 2.421875 | 2 |
setup.py | Louis-Navarro/decorators | 0 | 22367 | <reponame>Louis-Navarro/decorators<filename>setup.py
import setuptools
from decorators.__init__ import __version__ as v
with open('README.md') as fp:
long_description = fp.read()
setuptools.setup(
name='decorators-LOUIS-NAVARRO',
version=v,
author='<NAME>',
description='Function decorators I made'... | 1.609375 | 2 |
test_undirect_graf.py | rodrigondec/Grafos | 0 | 22368 | from grafo import Grafo, DiGrafo
from no import No
from aresta import Aresta
import unittest
class TestStringMethods(unittest.TestCase):
def setUp(self):
self.grafo = Grafo()
def test_atingivel(self):
self.grafo.insertNo(No(1))
self.grafo.insertNo(No(2))
self.grafo.insertNo(No(3))
self.grafo.insertNo(No(4... | 3.140625 | 3 |
fancy/config/option.py | susautw/fancy-config | 1 | 22369 | <gh_stars>1-10
import warnings
from typing import Any, Callable, TYPE_CHECKING
from . import ConfigStructure
from .process import auto_process_typ
from ..config import identical
if TYPE_CHECKING:
from ..config import BaseConfig
class Option:
_type: Callable[[Any], Any]
_required: bool
_nullable: boo... | 2.171875 | 2 |
data_loader_manual.py | Chen-Yifan/DEM_building_segmentation | 0 | 22370 | <reponame>Chen-Yifan/DEM_building_segmentation
from PIL import Image
import numpy as np
import os
import re
import scipy.misc
import random
import sys
import csv
def is_feature_present(input_array):
return (np.sum(input_array!=0)>10) # select the image with more than 50 pixel label
def load_feature_d... | 2.75 | 3 |
autotest/osr/osr_micoordsys.py | robe2/gdal | 0 | 22371 | #!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test some MITAB specific translation issues.
# Author: <NAME>, <even dot rouault at mines dash paris dot org>
#
###################################################... | 1.539063 | 2 |
maintain.py | keioni/ink_01 | 0 | 22372 | <filename>maintain.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
from ink.maintainer import make_pickle, DatabaseMaintainer
from ink.sys.config import CONF
from ink.sys.database.connector.mysql import MySQLConnector
from ink.sys.database.connector.null import NullConnector
def _... | 2.40625 | 2 |
serpentmonkee/UtilsMonkee.py | anthromorphic-ai/serpentmonkee | 0 | 22373 | <filename>serpentmonkee/UtilsMonkee.py
import requests
from dateutil import parser
import json
from datetime import datetime, timezone
import time
import sys
import random
import uuid
import copy
# --------------------------------------------------------------------
class RoundTripEncoder(json.JSONEncoder):
DA... | 2.625 | 3 |
backend/app/bucket.py | thanet-s/subme-selected-topics-project | 0 | 22374 | <reponame>thanet-s/subme-selected-topics-project
from minio import Minio
import os
minio_client = Minio(
os.environ['MINIO_HOST'],
access_key=os.environ['MINIO_ROOT_USER'],
secret_key=os.environ['MINIO_ROOT_PASSWORD'],
secure=False
) | 1.492188 | 1 |
publications/PrADA/experiments/income_census/train_config.py | UMDataScienceLab/research | 49 | 22375 | from data_process.census_process.census_data_creation_config import census_data_creation
fg_feature_extractor_architecture_list = [[28, 56, 28, 14],
[25, 50, 25, 12],
[56, 86, 56, 18],
[27, 54,... | 1.976563 | 2 |
tools/create_transmit_grouped_command_cron.py | Vayel/GUCEM-BVC | 2 | 22376 | <filename>tools/create_transmit_grouped_command_cron.py
import os
from cron_helper import create
JOB_COMMENT = 'BVC transmit grouped command reminder'
HERE = os.path.dirname(os.path.abspath(__file__))
def create_job(cron):
job = cron.new(
command=os.path.join(HERE, 'manage.sh transmit_grouped_command_re... | 2.515625 | 3 |
network/plot_along_subunits.py | AspirinCode/MD-analysis-tools-scripts | 5 | 22377 | <reponame>AspirinCode/MD-analysis-tools-scripts<gh_stars>1-10
import pickle
import numpy as np
import matplotlib.pyplot as plt
i = 1
fig = plt.figure(figsize=(30,30))
for pickle_file in pickle_list:
c_B = pickle.load(open(pickle_file, "rb"))
#plot_c_B(c_B, f"bet_centrality_with_{pickle_file[19:-4]}.png")
... | 2.171875 | 2 |
runme.py | AndreWohnsland/Cocktailmaker_AW | 37 | 22378 | <filename>runme.py
import sys
from PyQt5.QtWidgets import QApplication
import src_ui.setup_mainwindow as setupui
if __name__ == "__main__":
app = QApplication(sys.argv)
w = setupui.MainScreen()
w.showFullScreen()
w.setFixedSize(800, 480)
sys.exit(app.exec_())
| 2.109375 | 2 |
src/ellalgo/ell_stable.py | luk036/ellalgo | 0 | 22379 | # -*- coding: utf-8 -*-
import math
from typing import Tuple, Union
import numpy as np
from .cutting_plane import CUTStatus
Arr = Union[np.ndarray]
class ell_stable:
"""Ellipsoid Search Space
ell_stable = {x | (x − xc)' Q^−1 (x − xc) ≤ κ}
Returns:
[type] -- [description]
"""
... | 2.484375 | 2 |
app/auth/forms.py | PhysicsUofRAUI/lifeLongLearning | 0 | 22380 | from flask_wtf import FlaskForm
from wtforms import PasswordField, StringField, SubmitField
from wtforms.validators import DataRequired
#
# Purpose: This from will be used to collect the information for the user logging
# and logging out.
#
# Fields:
# Password: <PASSWORD>
# Username: This contains the nam... | 3.296875 | 3 |
netmiko/f5/f5_tmsh_ssh.py | josephwhite13/netmiko | 1 | 22381 | import time
from netmiko.base_connection import BaseConnection
class F5TmshSSH(BaseConnection):
def session_preparation(self):
"""Prepare the session after the connection has been established."""
self._test_channel_read()
self.set_base_prompt()
self.tmsh_mode()
self.set_bas... | 2.453125 | 2 |
tools/database_tool.py | noahzhy/qumaishou | 0 | 22382 | <gh_stars>0
import os
import pandas as pd
import sys
import glob
# 导入同级目录下其他文件夹下的文件
sys.path.append("./")
db_dir_path = 'database'
def db_save(db_name, df):
# index 表示是否显示行名,default=True
df = remove_repetition(df)
if df.to_csv(os.path.join(db_dir_path, '{}.csv'.format(db_name)), index=False, sep=','):
... | 3.015625 | 3 |
flika/tests/test_settings.py | flika-org/flika | 19 | 22383 | from .. import global_vars as g
from ..window import Window
import numpy as np
from ..roi import makeROI
class TestSettings():
def test_random_roi_color(self):
initial = g.settings['roi_color']
g.settings['roi_color'] = 'random'
w1 = Window(np.random.random([10, 10, 10]))
roi1 = makeROI('rectangle', [[1, 1],... | 2.3125 | 2 |
tests/test_runner.py | varunvarma/panoptes | 0 | 22384 | <gh_stars>0
"""
Copyright 2018, Oath Inc.
Licensed under the terms of the Apache 2.0 license. See LICENSE file in project root for terms.
"""
import re
import unittest
from mock import patch, MagicMock, Mock, PropertyMock
from testfixtures import LogCapture
from yahoo_panoptes.framework.plugins.panoptes_base_plugin i... | 1.734375 | 2 |
root/tpd_near_trainstops_per_line.py | transitanalystisarel/TransitAnalystIsrael | 0 | 22385 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# collect a set of trip_id s at all stops in a GTFS file over the selected week of the service period starting at serviceweekstartdate
# filter stops near trainstations based on input txt file - stopsneartrainstop_post_edit
# merge sets of trips at stops near each trainst... | 2.9375 | 3 |
merlin/modules/normalization.py | ethereon/merlin | 1 | 22386 | from typing import Callable, Optional, Union
import tensorflow as tf
from merlin.initializers import Init
from merlin.modules.keras import KerasAdapter
from merlin.shape import Axis
from merlin.spec import DynamicSpec, Spec
class BatchNormalization(KerasAdapter, tf.keras.layers.BatchNormalization):
class Confi... | 2.5625 | 3 |
Plots/Bar/NCL_bar_2.py | learn2free/GeoCAT-examples | 1 | 22387 | """
NCL_bar_2.py
===============
This script illustrates the following concepts:
- Drawing bars instead of curves in an XY plot
- Changing the aspect ratio of a bar plot
- Drawing filled bars up or down based on a Y reference value
- Setting the minimum/maximum value of the Y axis in a bar plot
- Using n... | 3.640625 | 4 |
gabbi/tests/test_driver.py | scottwallacesh/gabbi | 145 | 22388 | #
# 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, software
# distributed under... | 2.21875 | 2 |
mindspore/ops/operations/_inner_ops.py | ZephyrChenzf/mindspore | 0 | 22389 | <gh_stars>0
# Copyright 2020 Huawei Technologies Co., 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 applicable law ... | 1.820313 | 2 |
migrations/versions/7f447c94347a_.py | tipabu/jazzband-website | 0 | 22390 | <filename>migrations/versions/7f447c94347a_.py
"""
Revision ID: 7<PASSWORD>c<PASSWORD>
Revises: <PASSWORD>
Create Date: 2017-11-17 14:59:36.177805
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<PASSWORD>"
down_revision = "<PASSWORD>"
def upgrade():
op.a... | 1.390625 | 1 |
abcvoting/preferences.py | pbatko/abcvoting | 0 | 22391 | <filename>abcvoting/preferences.py
"""
Dichotomous (approval) preferences and preference profiles
Voters are indexed by 0, ..., len(profile)
Candidates are indexed by 0, ..., profile.num_cand
"""
from abcvoting.misc import str_candset
from collections import OrderedDict
class Profile(object):
"""
Preference... | 3.1875 | 3 |
java/create_solution.py | hermantai/kata | 0 | 22392 | <reponame>hermantai/kata<gh_stars>0
import os
import sys
templ = """package kata;
import static kata.Printer.*;
import java.util.*;
/**
* Cracking the coding interview 6th ed. p.XX(TODO)
*/
public class %(classname)s {
static int %(methodname)s(String str) {
return 0;
}
public static void main(String ar... | 3.34375 | 3 |
tests/unit/helpers_test/test_password.py | alefeans/flask-base | 11 | 22393 | <reponame>alefeans/flask-base
import pytest
from app.helpers import check_password, encrypt_password
@pytest.mark.parametrize('sent', [
('test'),
('changeme'),
('1234123'),
])
def test_if_check_password_and_encrypt_password_works_properly(sent):
expected = encrypt_password(sent)
assert check_passw... | 2.515625 | 3 |
tests/output/test_pdf_to_png.py | ynikitenko/lena | 4 | 22394 | <reponame>ynikitenko/lena<gh_stars>1-10
from __future__ import print_function
import os
import pytest
import subprocess
import sys
import lena.core
from lena.output import PDFToPNG
def test_pdf_to_png(mocker):
mocker.patch("subprocess.Popen.communicate", return_value=("stdout", "stderr"))
mocker.patch("subp... | 2.109375 | 2 |
third_party/maya/lib/usdMaya/testenv/testUsdExportSkeleton.py | navefx/YuksUSD | 6 | 22395 | #!/pxrpythonsubst
#
# Copyright 2018 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | 1.90625 | 2 |
datamux/src/datamux/simulate_mode.py | nirdslab/streaminghub | 0 | 22396 | <gh_stars>0
class SimulateMode:
@staticmethod
def start_simulation(device, guide=None):
return
| 1.515625 | 2 |
tests/integration/test_k8s.py | lslebodn/conu | 95 | 22397 | <filename>tests/integration/test_k8s.py
# -*- coding: utf-8 -*-
#
# Copyright Contributors to the Conu project.
# SPDX-License-Identifier: MIT
#
"""
Tests for Kubernetes backend
"""
import urllib3
import pytest
from conu import DockerBackend, \
K8sBackend, K8sCleanupPolicy
from conu.backend.k8s.pod ... | 2.171875 | 2 |
fanyi.py | smithgoo/python3Learn | 1 | 22398 | <filename>fanyi.py<gh_stars>1-10
#!/usr/bin/python
#coding:utf-8
import requests
import json
headers ={"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Referer": "http://fanyi.baidu.com/translate?aldtype=16047&que... | 3.203125 | 3 |
frads/radmtx.py | LBNL-ETA/frads | 8 | 22399 | """ Support matrices generation.
radmtx module contains two class objects: sender and receiver, representing
the ray sender and receiver in the rfluxmtx operation. sender object is can
be instantiated as a surface, a list of points, or a view, and these are
typical forms of a sender. Similarly, a receiver object can b... | 2.90625 | 3 |