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 |
|---|---|---|---|---|---|---|
source/utils/converters.py | GoBoopADog/maelstrom | 2 | 17300 | <gh_stars>1-10
from discord.ext import commands
from typing import Union
from types import ModuleType
from .context import Context
class SourceConverter(commands.Converter):
"""A Converter that converts a string to a Command, Cog or Extension."""
async def convert(
self, ctx: Context, argument: str
... | 2.75 | 3 |
credstuffer/db/creator.py | bierschi/credstuffer | 0 | 17301 | <reponame>bierschi/credstuffer
import logging
from credstuffer.db.connector import DBConnector
from credstuffer.exceptions import DBCreatorError
class Database:
""" class Database to build a sql string for Database creation
USAGE:
Database(name="web")
"""
def __init__(self, name):
... | 2.859375 | 3 |
src/poetry/core/masonry/builder.py | DavidVujic/poetry-core | 0 | 17302 | from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from poetry.core.poetry import Poetry
class Builder:
def __init__(self, poetry: Poetry) -> None:
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.masonr... | 2.578125 | 3 |
migrations/versions/429d596c43a7_users_country.py | bilginfurkan/Anonimce | 2 | 17303 | """users.country
Revision ID: 429d596c43a7
Revises: <PASSWORD>
Create Date: 2020-10-23 21:26:55.598146
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '429d596c43a7'
down_revision = '77e0c0edaa04'
branch_labels = None
depends_on = None
def upgrade():
# ##... | 1.546875 | 2 |
tweet_processor.py | cristynhoward/connectfour | 1 | 17304 | """ Module for processing mentions of the bot via the Twitter API.
"""
from ConnectFourGame import *
from databasehelpers import *
from helpers import *
from minimax import *
def process_mentions():
""" Scan through recent mentions and send them to be processed.
"""
api = get_twitter_api()
first = Tru... | 3.125 | 3 |
code/seasonality.py | geangohn/RecSys | 2 | 17305 | import pandas as pd
def get_seasonality_weekly(bills, date_column='dates', group_column='level_4_name',
regular_only=False, promo_fact_column=None):
bills['week'] = pd.to_datetime(bills[date_column]).dt.week
bills['year'] = pd.to_datetime(bills[date_column]).dt.year
# - Группиру... | 2.703125 | 3 |
discord_api/applications.py | tuna2134/discord-api.py | 10 | 17306 | from .command import Command, ApiCommand
class Application:
def __init__(self, client):
self.client = client
self.http = client.http
self.__commands = []
async def fetch_commands(self) -> List[ApiCommand]:
"""
This can fetch discord application commands from dis... | 3.015625 | 3 |
SinglePackage/tests/test_single.py | CJosephides/PythonApplicationStructures | 1 | 17307 | <reponame>CJosephides/PythonApplicationStructures
from unittest import TestCase, main
from single_package.single import Single
class SingleTests(TestCase):
def setUp(self):
self.single = Single()
def test_Single(self):
self.assertIsInstance(self.single, Single)
if __name__ == "__main__":
... | 1.914063 | 2 |
tests/spot/sub_account/test_sub_account_deposit_address.py | Banging12/binance-connector-python | 512 | 17308 | <reponame>Banging12/binance-connector-python
import responses
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.lib.utils import encoded_string
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "val... | 2.609375 | 3 |
tools/telemetry/telemetry/results/page_test_results.py | Fusion-Rom/android_external_chromium_org | 1 | 17309 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import copy
import traceback
from telemetry import value as value_module
from telemetry.results import page_run
from telemetry.results im... | 2.265625 | 2 |
src/utils/gradcam.py | xmuyzz/IVContrast | 3 | 17310 | from tensorflow.keras.models import Model
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import cv2
import numpy as np
import pandas as pd
from tensorflow.keras.models import load_model
import tensorflow as tf
import os
#--------------... | 2.65625 | 3 |
start.py | xylovedd/yangyang | 20 | 17311 | <reponame>xylovedd/yangyang<filename>start.py<gh_stars>10-100
# coding:utf-8
"""
start rob task good luck!
> python start.py
"""
import datetime
import time
from sys import version_info
import threadpool
import ticket_config as config
from config.stations import check_station_exists
from train.login import Login
f... | 2.5 | 2 |
frameworks/PHP/cakephp/setup.py | idlewan/FrameworkBenchmarks | 0 | 17312 |
import subprocess
import sys
import os
import setup_util
from os.path import expanduser
def start(args, logfile, errfile):
fwroot = args.fwroot
setup_util.replace_text("cakephp/app/Config/database.php", "'host' => '.*',", "'host' => '" + args.database_host + "',")
setup_util.replace_text("cakephp/app/Config/cor... | 1.9375 | 2 |
Functions/parsetool.py | AlessandroChen/KindleHelper | 19 | 17313 | <reponame>AlessandroChen/KindleHelper<gh_stars>10-100
import os, stat
def addPermission(Filename):
os.chmod(Filename, os.stat(Filename).st_mode | stat.S_IXUSR);
def transform(content):
name = '';
for i in range(0, len(content)):
if (content[i] == ' ' and content[i + 1] == ' '):
name +=... | 2.703125 | 3 |
caiman/models.py | Rockstreet/usman_min | 0 | 17314 | from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
| 1.15625 | 1 |
Code/utils.py | minna-ust/SemanticMapGeneration | 8 | 17315 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Common utility functions
Created on Sun May 27 16:37:42 2018
@author: chen
"""
import math
import cv2
import os
from imutils import paths
import numpy as np
import scipy.ndimage
def rotate_cooridinate(cooridinate_og,rotate_angle,rotate_center):
"""
calculat... | 3.03125 | 3 |
py_git/working_with_github/main.py | gabrieldemarmiesse/my_work_environment | 1 | 17316 | <reponame>gabrieldemarmiesse/my_work_environment<filename>py_git/working_with_github/main.py<gh_stars>1-10
import os
import sys
from subprocess import CalledProcessError
from working_with_github.utils import run
def checkout_pr():
user, branch = sys.argv[1].split(":")
_checkout_pr(user, branch)
def _checko... | 2.390625 | 2 |
main.py | Lee-Kevin/Danboard | 0 | 17317 | import logging
import time
import re
import serial
from threading import Thread, Event
from respeaker import Microphone
from respeaker import BingSpeechAPI
from respeaker import PixelRing,pixel_ring
BING_KEY = '95e4fe8b3a324389be4595bd1813121c'
ser = serial.Serial('/dev/ttyS1',115200,timeout=0)
data=[0xAA,0x01,0x64,... | 2.34375 | 2 |
apis/vote_message/account_voteCredit.py | DerWalundDieKatze/Yumekui | 0 | 17318 | #!/usr/bin/env python
# encoding: utf-8
'''
@author: caroline
@license: (C) Copyright 2019-2022, Node Supply Chain Manager Corporation Limited.
@contact: <EMAIL>
@software: pycharm
@file: account_voteCredit.py
@time: 2020/1/8 11:23 上午
@desc:
'''
from apis.API import request_Api
def voteCredit(api_name, params):
'''... | 2.171875 | 2 |
src/pla.py | socofels/ML_base_alg | 0 | 17319 | <reponame>socofels/ML_base_alg
import numpy as np
from matplotlib import pyplot as plt
def sign(y_pred):
y_pred = (y_pred >= 0) * 2 - 1
return y_pred
def plot(x, w):
plt.scatter(x[:, 1][pos_index], x[:, 2][pos_index], marker="P")
plt.scatter(x[:, 1][neg_index], x[:, 2][neg_index], marker=0)
x = ... | 2.578125 | 3 |
pupa/scrape/vote_event.py | azban/pupa | 62 | 17320 | <filename>pupa/scrape/vote_event.py<gh_stars>10-100
from ..utils import _make_pseudo_id
from .base import BaseModel, cleanup_list, SourceMixin
from .bill import Bill
from .popolo import pseudo_organization
from .schemas.vote_event import schema
from pupa.exceptions import ScrapeValueError
import re
class VoteEvent(Ba... | 2.28125 | 2 |
Q/questionnaire/models/models_publications.py | ES-DOC/esdoc-questionnaire | 0 | 17321 | ####################
# ES-DOC CIM Questionnaire
# Copyright (c) 2017 ES-DOC. All rights reserved.
#
# University of Colorado, Boulder
# http://cires.colorado.edu/
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT].
####################
from djan... | 1.953125 | 2 |
tests/management/commands/test_create_command.py | kaozdl/django-extensions | 0 | 17322 | # -*- coding: utf-8 -*-
import os
import shutil
from django.conf import settings
from django.core.management import call_command
from django.test import TestCase
from six import StringIO
try:
from unittest.mock import patch
except ImportError:
from mock import patch
class CreateCommandTests(TestCase):
"... | 2.453125 | 2 |
pca.py | mghaffarynia/PCA | 0 | 17323 | <gh_stars>0
import pandas as pd
import numpy as np
from cvxopt import matrix
from cvxopt import solvers
import math
def read_csv_input(filename):
df = pd.read_csv(filename, header = None).to_numpy()
y = df[:, [-1]]
X = df[:, range(df.shape[1]-1)]
return X, y
def opt(X, y, c):
m, n = X.shape
P_top = np.... | 2.28125 | 2 |
pyadds/__init__.py | wabu/pyadds | 0 | 17324 | class AnythingType(set):
def __contains__(self, other):
return True
def intersection(self, other):
return other
def union(self, other):
return self
def __str__(self):
return '*'
def __repr__(self):
return "Anything"
Anything = AnythingType()
| 3.265625 | 3 |
lookup.py | apinkney97/IP2Location-Python | 90 | 17325 | <filename>lookup.py<gh_stars>10-100
import os, IP2Location, sys, ipaddress
# database = IP2Location.IP2Location(os.path.join("data", "IPV6-COUNTRY.BIN"), "SHARED_MEMORY")
database = IP2Location.IP2Location(os.path.join("data", "IPV6-COUNTRY.BIN"))
try:
ip = sys.argv[1]
if ip == '' :
print ('You canno... | 2.921875 | 3 |
ADTs/ADT_of_staff.py | hitachinsk/DataStructure | 0 | 17326 | import ADT_of_person as AP
import datetime as dm
#ADT Staff()
# Staff(self, str name, str sex, tuple birthday, tuple entey_date, int salary, str position)
# name(self)
# sex(self)
# en_year(self)
# salary(self)
# set_salary(self, new_salary)
# position(self)
# set_position(self, new_position... | 3.015625 | 3 |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/tests/completion_integration/test_handlers.py | osoco/better-ways-of-thinking-about-software | 3 | 17327 | """
Test signal handlers for completion.
"""
from datetime import datetime
from unittest.mock import patch
import ddt
import pytest
from completion import handlers
from completion.models import BlockCompletion
from completion.test_utils import CompletionSetUpMixin
from django.test import TestCase
from pytz import utc... | 2.390625 | 2 |
objects/moving_wall.py | krzysztofarendt/ballroom | 0 | 17328 | from typing import Tuple
import pygame
import numpy as np
from .wall import Wall
class MovingWall(Wall):
def __init__(self,
top: int = 0,
left: int = 0,
bottom: int = 1,
right: int = 1):
super().__init__(top, left, bottom, right)
... | 3.0625 | 3 |
src/example/4.Color_sensor/color_sensor.light_up.py | rundhall/ESP-LEGO-SPIKE-Simulator | 0 | 17329 | light_up(light_1, light_2, light_3)
Sets the brightness of the individual lights on the Color Sensor.
This causes the Color Sensor to change modes, which can affect your program in unexpected ways. For example, the Color Sensor can't read colors when it's in light up mode.
Parameters
light_1
The desired brightness of ... | 3.5 | 4 |
utils.py | gbene/pydip | 0 | 17330 | <reponame>gbene/pydip
'''
Script by: <NAME>
date: 25/06/2021
Utilities functions. This file is used to have a more organized main script. It contains:
+ Random plane orientation generator that can be used to practice plane attitude interpretation
+ Random fold generator
+ Plotter
+ Data converter from pandas dataf... | 2.953125 | 3 |
debug/free_transition_vi_lofar_dr2_realdata.py | Joshuaalbert/bayes_filter | 0 | 17331 | import tensorflow as tf
import os
from bayes_filter import logging
from bayes_filter.filters import FreeTransitionVariationalBayes
from bayes_filter.feeds import DatapackFeed, IndexFeed
from bayes_filter.misc import make_example_datapack, maybe_create_posterior_solsets, get_screen_directions
from bayes_filter.datapack ... | 1.914063 | 2 |
train.py | Aoi-hosizora/NER-BiLSTM-CRF-Affix-PyTorch | 0 | 17332 | <reponame>Aoi-hosizora/NER-BiLSTM-CRF-Affix-PyTorch
import argparse
import json
import matplotlib.pyplot as plt
import numpy as np
import pickle
import time
import torch
from torch import optim
from typing import Tuple, List, Dict
import dataset
from model import BiLSTM_CRF
import utils
def parse_args():
parser ... | 2.3125 | 2 |
utils/exceptions.py | acatiadroid/util-bot | 1 | 17333 | from pymongo.errors import PyMongoError
class IdNotFound(PyMongoError):
"""Raised when _id was not found in the database collection."""
def __init__(self, *args):
if args:
self.message = args[0]
else:
self.message = self.__doc__
def __str__(self):
return s... | 2.859375 | 3 |
envs/flatland/utils/gym_env_wrappers.py | netceteragroup/Flatland-Challenge | 4 | 17334 |
from typing import Dict, Any, Optional, List
import gym
import numpy as np
from collections import defaultdict
from flatland.core.grid.grid4_utils import get_new_position
from flatland.envs.agent_utils import EnvAgent, RailAgentStatus
from flatland.envs.rail_env import RailEnv, RailEnvActions
from envs.flatland.obse... | 2.359375 | 2 |
acceptability/models/cbow_classifier.py | nyu-mll/CoLA-baselines | 54 | 17335 | import torch
from torch import nn
class CBOWClassifier(nn.Module):
"""
Continuous bag of words classifier.
"""
def __init__(self, hidden_size, input_size, max_pool, dropout=0.5):
"""
:param hidden_size:
:param input_size:
:param max_pool: if true then max pool over word ... | 2.90625 | 3 |
tests/test_validators.py | yaaminu/yaval | 14 | 17336 | <gh_stars>10-100
import datetime
from mock import Mock, call
import pytest
from finicky import ValidationException, is_int, is_float, is_str, is_date, is_dict, is_list
# noinspection PyShadowingBuiltins
class TestIntValidator:
def test_must_raise_validation_exception_when_input_is_none_and_required_is_true(self... | 2.765625 | 3 |
polygon.py | SYED-RAFI-NAQVI/10hourcodingchallenge | 0 | 17337 | import numpy as np
import cv2 as cv
img = cv.imread('1.jpeg',cv.IMREAD_COLOR)
#for polygon we need to have set of points so we create a numpy array. and pts is an object.
pts = np.array([[20,33],[300,120], [67,79], [123,111], [144,134]], np.int32)
#the method polylines will actully draws a polygon by taking differe... | 3.484375 | 3 |
lib/fathead/firefox_about_config/parse.py | aeisenberg/zeroclickinfo-fathead | 1 | 17338 | #!/usr/bin/env python2
from BeautifulSoup import BeautifulSoup, NavigableString
import urllib
import string
import re
class Entry(object):
def __init__(self, name, value, description, url):
self.name = name
self.value = value
self.description = description
self.url = url
def ... | 3.140625 | 3 |
sources/simulators/multiprocessing_simulator/start_client.py | M4rukku/impact_of_non_iid_data_in_federated_learning | 0 | 17339 | <reponame>M4rukku/impact_of_non_iid_data_in_federated_learning
import flwr as fl
import flwr.client
from sources.utils.simulation_parameters import DEFAULT_SERVER_ADDRESS
from sources.simulators.base_client_provider import BaseClientProvider
def start_client(client_provider: BaseClientProvider, client_identifier):
... | 2.28125 | 2 |
aea/helpers/pipe.py | bryanchriswhite/agents-aea | 126 | 17340 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | 2 | 2 |
src/config/svc-monitor/svc_monitor/tests/test_port_tuple.py | UbuntuEvangelist/contrail-controller | 0 | 17341 | <filename>src/config/svc-monitor/svc_monitor/tests/test_port_tuple.py
import mock
from mock import patch
import unittest
from vnc_api.vnc_api import *
from svc_monitor.port_tuple import PortTupleAgent
from svc_monitor.config_db import *
import test_common_utils as test_utils
class PortTupleTest(unittest.TestCase):
... | 2.046875 | 2 |
pearll/agents/ga.py | LondonNode/Anvil | 13 | 17342 | <filename>pearll/agents/ga.py
from functools import partial
from typing import Callable, List, Optional, Type
import numpy as np
from gym.vector.vector_env import VectorEnv
from pearll.agents.base_agents import BaseAgent
from pearll.buffers import RolloutBuffer
from pearll.buffers.base_buffer import BaseBuffer
from p... | 2.078125 | 2 |
src/tequila/optimizers/optimizer_scipy.py | snc2/tequila | 0 | 17343 | import scipy, numpy, typing, numbers
from tequila.objective import Objective
from tequila.objective.objective import assign_variable, Variable, format_variable_dictionary, format_variable_list
from .optimizer_base import Optimizer
from ._containers import _EvalContainer, _GradContainer, _HessContainer, _QngContainer
fr... | 2.671875 | 3 |
Section_3.3_simul_3/2_Runtime/bsolar.py | isaac2math/solar | 0 | 17344 | <gh_stars>0
import numpy as np
import time
import warnings
from sklearn.linear_model import LinearRegression
from solar import solar
from sklearn.exceptions import ConvergenceWarning
# For recent version of Scikit-learn: since the class 'Lars' may rely on the Cholesky decomposition and hence may have... | 2.921875 | 3 |
solutions/nelum_pokuna.py | UdeshUK/RxH5-Prextreme | 1 | 17345 | <gh_stars>1-10
cases=int(raw_input())
for case in range(cases):
answers=[0,0]
grid=[[0 for x in range(4)] for y in range(2)]
common=[]
for i in range(2):
answers[i]=int(raw_input())
for j in range(4):
grid[i][j]=raw_input().split()
grid[i][j] = map(int, grid[i][... | 3.234375 | 3 |
chi/_mechanistic_models.py | DavAug/erlotinib | 0 | 17346 | #
# This file is part of the chi repository
# (https://github.com/DavAug/chi/) which is released under the
# BSD 3-clause license. See accompanying LICENSE.md for copyright notice and
# full license details.
#
import copy
import myokit
import myokit.formats.sbml as sbml
import numpy as np
class MechanisticModel(obj... | 2.421875 | 2 |
smartlicense/settings/__init__.py | coblo/smartlicense | 6 | 17347 | <reponame>coblo/smartlicense<filename>smartlicense/settings/__init__.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Django settings for smartlicense project.
Generated by 'django-admin startproject' using Django 2.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For th... | 1.632813 | 2 |
firmwire/memory_map.py | j4s0n/FirmWire | 0 | 17348 | ## Copyright (c) 2022, Team FirmWire
## SPDX-License-Identifier: BSD-3-Clause
from enum import Enum, auto
from .hw.soc import SOCPeripheral
class MemoryMapEntryType(Enum):
GENERIC = auto()
FILE_BACKED = auto()
PERIPHERAL = auto()
ANNOTATION = auto()
class MemoryMapEntry:
def __init__(self, ty, s... | 2.21875 | 2 |
src/resources/Land.py | noancloarec/mapisto-api | 0 | 17349 | <gh_stars>0
from .helper import fill_optional_fields
from maps_geometry.feature_extraction import get_bounding_box
from .MapistoShape import MapistoShape
from .BoundingBox import BoundingBox
class Land:
def __init__(self, land_id, representations: list, bounding_box=None):
assert isinstance(bounding_box,... | 2.46875 | 2 |
reexercises/two_sum_target.py | R0bertWell/interview_questions | 0 | 17350 | <gh_stars>0
from typing import List
def two_sum(lis: List[int], target: int):
dici = {}
for i, value in enumerate(lis):
objetive = target - value
if objetive in dici:
return [dici[objetive], i]
dici[value] = i
return []
print(two_sum([1, 2, 3, 4, 5, 6], 7))
| 3.375 | 3 |
vue/decorators/base.py | adamlwgriffiths/vue.py | 274 | 17351 | from vue.bridge import Object
import javascript
class VueDecorator:
__key__ = None
__parents__ = ()
__id__ = None
__value__ = None
def update(self, vue_dict):
base = vue_dict
for parent in self.__parents__:
base = vue_dict.setdefault(parent, {})
if self.__id__... | 2.359375 | 2 |
datalabeling/google/cloud/datalabeling_v1beta1/proto/data_labeling_service_pb2_grpc.py | DaveCheez/google-cloud-python | 2 | 17352 | <filename>datalabeling/google/cloud/datalabeling_v1beta1/proto/data_labeling_service_pb2_grpc.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.datalabeling_v1beta1.proto import (
annotation_spec_set_pb2 as google_dot_cloud_dot_datalabeling__v1beta1_dot_proto_do... | 1.429688 | 1 |
keras_version/utils.py | nunu0910/BiO-Net | 44 | 17353 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import keras
from keras.models import Model, load_model
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) # mute deprecation warnings
from kera... | 2.046875 | 2 |
sdk/python/pulumi_azure_native/batch/__init__.py | polivbr/pulumi-azure-native | 0 | 17354 | # 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! ***
from .. import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .application import *
from .application_... | 1.203125 | 1 |
setup.py | tgolsson/appJar | 666 | 17355 | from setuptools import setup, find_packages
__name__ = "appJar"
__version__ = "0.94.0"
__author__ = "<NAME>"
__desc__ = "An easy-to-use, feature-rich GUI wrapper for tKinter. Designed specifically for use in the classroom, but powerful enough to be used anywhere."
__author_email__ = "<E... | 2.203125 | 2 |
pertama/andir.py | alitkurniawan48/BelajarGIS | 2 | 17356 | import shapefile
class Andir:
def __init__(self):
self.kelurahan = shapefile.Writer(
'kelurahan_andir', shapeType=shapefile.POLYGON)
self.kelurahan.shapeType
self.kelurahan.field('kelurahan_di_andir', 'C')
self.kantor = shapefile.Writer(
'kantor_kelurahan_a... | 2.78125 | 3 |
sparseconvnet/utils.py | THU-luvision/Occuseg | 1 | 17357 | # Copyright 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch, glob, os
from .sparseConvNetTensor import SparseConvNetTensor
from .metadata import Metadata
import sparsecon... | 1.890625 | 2 |
sysinv/sysinv/sysinv/sysinv/puppet/nfv.py | MarioCarrilloA/config | 0 | 17358 | #
# Copyright (c) 2017-2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.common import constants
from sysinv.common import utils
from sysinv.helm import helm
from sysinv.puppet import openstack
class NfvPuppet(openstack.OpenstackBasePuppet):
"""Class to encapsulate puppet opera... | 1.75 | 2 |
qualif16/timeline.py | valenca/hashcode16 | 1 | 17359 | from data import *
from heapq import *
class Timeline:
def __init__(self):
self.events=[]
def addEvent(self, event):
heappush(self.events, event)
def nextEvent(self):
assert(self.events != [])
return heappop(self.events)
def nextEvents(self):
if self.events == []:
return []
cur_time = self.event... | 3.25 | 3 |
cfgov/v1/util/migrations.py | hkeeler/cfgov-refresh | 0 | 17360 | import json
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from treebeard.mp_tree import MP_Node
try:
from wagtail.core.blocks import StreamValue
except ImportError: # pragma: no cover; fallback for Wagtail < 2.0
from wagtail.wagtailcore.blocks import StreamValue
... | 2.078125 | 2 |
source/codes.py | Very1Fake/monitor | 0 | 17361 | <reponame>Very1Fake/monitor<gh_stars>0
from typing import Dict
_codes: Dict[int, str] = {
# Debug (1xxxx)
# System (100xx)
10000: 'Test debug',
# Pipe (103xx)
10301: 'Reindexing parser',
# Resolver (109xx)
10901: 'Executing catalog',
10902: 'Executing target',
10903: 'Catalog exec... | 2.390625 | 2 |
Stack.py | jdegene/ArcGIS-scripts | 0 | 17362 | <filename>Stack.py
# Erstellt aus vielen TIFF Datei eine stacked Datei mit dem ArcGIS
# Tool composite bands
import arcpy
import os
arcpy.env.overwriteOutput = True # Ueberschreiben fuer ArcGIS aktivieren
arcpy.env.pyramid = "NONE" # Verhindert dass Pyramiden berechnet werden
arcpy.env.rasterStatistics = "NONE"... | 2.140625 | 2 |
tests/test_frozenordereddict.py | tirkarthi/frozenordereddict | 2 | 17363 | from collections import OrderedDict
from unittest import TestCase
from frozenordereddict import FrozenOrderedDict
class TestFrozenOrderedDict(TestCase):
ITEMS_1 = (
("b", 2),
("a", 1),
)
ITEMS_2 = (
("d", 4),
("c", 3),
)
ODICT_1 = OrderedDict(ITEMS_1)
ODICT_2 ... | 2.9375 | 3 |
tests/test_data_gateway/test_dummy_serial.py | aerosense-ai/data-gateway | 0 | 17364 | import random
import unittest
from serial.serialutil import SerialException
from data_gateway.dummy_serial import DummySerial, constants, exceptions, random_bytes, random_string
from tests.base import BaseTestCase
class DummySerialTest(BaseTestCase):
def setUp(self):
"""Set up the test environment:
... | 3.03125 | 3 |
site/flask/lib/python2.7/site-packages/speaklater.py | theholyhades1/tartanHacks2015 | 32 | 17365 | <filename>site/flask/lib/python2.7/site-packages/speaklater.py<gh_stars>10-100
# -*- coding: utf-8 -*-
r"""
speaklater
~~~~~~~~~~
A module that provides lazy strings for translations. Basically you
get an object that appears to be a string but changes the value every
time the value is evaluated ba... | 3 | 3 |
test/test_graph.py | mits58/Python-Graph-Library | 0 | 17366 | <reponame>mits58/Python-Graph-Library<filename>test/test_graph.py
import unittest
import numpy as np
from graph import Graph
class TestGraphClass(unittest.TestCase):
"""
Test Class for Graph Class
"""
def test_generating_graph_object(self):
"""
Testing Generation of Graph Object from... | 3.375 | 3 |
09_cumledeki_kelime_sayisi.py | kabatasmirac/We_WantEd_OrnekCozumler | 1 | 17367 | def kelime_sayisi(string):
counter = 1
for i in range(0,len(string)):
if string[i] == ' ':
counter += 1
return counter
cumle = input("Cumlenizi giriniz : ")
print("Cumlenizdeki kelime sayisi = {}".format(kelime_sayisi(cumle))) | 3.59375 | 4 |
pdns-mysql-domain-exp/lib/db.py | kilgoretrout1985/pdns-mysql-domain-exp | 0 | 17368 | <filename>pdns-mysql-domain-exp/lib/db.py<gh_stars>0
import MySQLdb
def domains_from_db(connection_data: dict, at_a_time: int = 1000) -> list:
domains = []
for connect_params in connection_data:
if 'charset' not in connect_params:
connect_params['charset'] = 'utf8'
db = MySQLdb.con... | 2.671875 | 3 |
barni/_result.py | Thrameos/barni | 8 | 17369 | <gh_stars>1-10
###############################################################################
# Copyright (c) 2019 Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
#
# Written by <NAME>, <NAME>
# <EMAIL>
#
# LLNL-CODE-805904
#
# All rights reserved.
#
# Permission is ... | 1.304688 | 1 |
work/code/5fold/paddle_model.py | kkoren/2021CCFBDCI-QAmatch-rank5 | 0 | 17370 | # -*- coding: utf-8 -*-
"""
Created on %(date)s
@author: %Christian
"""
"""
#BASE +BN层
#dropout改为0.15
"""
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import paddlenlp as ppnlp
class QuestionMatching_base(nn.Layer):
'''
base模型
dropout改为0.15
'''
de... | 2.609375 | 3 |
q2_mlab/plotting/app.py | patrickimran/regression-benchmarking | 0 | 17371 | from functools import partialmethod
import pandas as pd
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
import sqlite3
import click
import json
import pkg_resources
from itertools import combinations
from q2_mlab.db.schema import RegressionScore
from q2_mlab.plotting.components import (
... | 1.9375 | 2 |
gpn/distributions/base.py | WodkaRHR/Graph-Posterior-Network | 23 | 17372 | <filename>gpn/distributions/base.py
import torch
import torch.distributions as D
class ExponentialFamily(D.ExponentialFamily):
"""
Shared base distribution for exponential family distributions.
"""
@property
def is_sparse(self):
"""
Whether the distribution's parameters are sparse.... | 2.984375 | 3 |
demos/python/3_statements.py | denfromufa/mipt-course | 0 | 17373 | <filename>demos/python/3_statements.py
#!/usr/bin/python
condition = 42
# IMPORTANT: colons, _indentation_ are significant!
if condition:
print "Condition is true!"
elif True: # not 'true'!
print "I said it's true! :)"
else:
print "Condition is false :("
# of course, elif/else are optional
assert True =... | 4.3125 | 4 |
dedupe/training.py | BrianSipple/dedupe | 1 | 17374 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
# provides functions for selecting a sample of training data
from itertools import combinations, islice
import blocking
import core
import numpy
import logging
import random
import sys
def findUncertainPairs(field_distances, data_model, bias=0.5):
"""
... | 2.8125 | 3 |
Chapter04/listcmp1.py | kaushalkumarshah/Learn-Python-in-7-Days | 12 | 17375 | list1 = [10,9,3,7,2,1,23,1,561,1,1,96,1]
def cmp1(x,y):
if x == 1 or y==1:
c = y-x
else:
c = x-y
return c
list1.sort(cmp = cmp1)
print list1 | 3.53125 | 4 |
ObitSystem/ObitTalk/test/template.py | sarrvesh/Obit | 5 | 17376 | from AIPS import AIPS
from AIPSTask import AIPSTask
from AIPSData import AIPSImage
from ObitTask import ObitTask
AIPS.userno = 103
image = AIPSImage('MANDELBROT', 'MANDL', 1, 1)
mandl = AIPSTask('mandl')
mandl.outdata = image
mandl.imsize[1:] = [ 512, 512 ]
mandl.go()
try:
template = ObitTask('Template')
te... | 2.125 | 2 |
src/voxelize.py | Beskamir/BlenderDepthMaps | 0 | 17377 | import bpy
import bmesh
import numpy
from random import randint
import time
# pointsToVoxels() has been modified from the function generate_blocks() in https://github.com/cagcoach/BlenderPlot/blob/master/blendplot.py
# Some changes to accomodate Blender 2.8's API changes were made,
# and the function has been made m... | 3 | 3 |
storage/lustre_client_iops/lustre_client_iops.py | jssfy/toolpedia | 0 | 17378 | #!/usr/bin/python
#-*-coding:utf-8-*-
import json
import sys
import time
# TBD: auto discovery
# data_path = "/proc/fs/lustre/llite/nvmefs-ffff883f8a4f2800/stats"
data_path = "/proc/fs/lustre/lmv/shnvme3-clilmv-ffff8859d3e2d000/md_stats"
# use a dic1/dic2 to hold sampling data
def load_data(dic):
# Open file ... | 2.3125 | 2 |
test/lsh_test.py | titusz/datasketch | 1 | 17379 | import unittest
from hashlib import sha1
import pickle
import numpy as np
from datasketch.lsh import MinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
class TestMinHashLSH(unittest.TestCase):
def test_init(self):
lsh = MinHashLSH(threshold=... | 2.75 | 3 |
src/datasets/tsn_dataset.py | tomstark99/epic-kitchens-100-fyrp | 2 | 17380 | import logging
from typing import Callable
from typing import List
import numpy as np
import torch.utils.data
from .video_dataset import VideoDataset
from .video_dataset import VideoRecord
LOG = logging.getLogger(__name__)
# line_profiler injects a "profile" into __builtins__. When not running under
# line_profile... | 2.234375 | 2 |
ce_cli/function.py | maiot-io/cengine | 7 | 17381 | <filename>ce_cli/function.py
import click
import ce_api
import base64
import os
from ce_cli.cli import cli, pass_info
from ce_cli.utils import check_login_status
from ce_cli.utils import api_client, api_call
from ce_api.models import FunctionCreate, FunctionVersionCreate
from ce_cli.utils import declare, notice
from ta... | 2.328125 | 2 |
office-plugin/windows-office/program/wizards/ui/event/RadioDataAware.py | jerrykcode/kkFileView | 6,660 | 17382 | #
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license noti... | 2.234375 | 2 |
Allura/allura/lib/patches.py | shalithasuranga/allura | 1 | 17383 | # 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, Version 2.0 (t... | 1.921875 | 2 |
leetcode/binary_search/search_for_a_range.py | phantomnat/python-learning | 0 | 17384 | from typing import List
class Solution:
def searchRange(self, nums: List[int], target: int) -> List[int]:
l,r=0,len(nums)-1
ans = -1
while l<r:
m = (l+r)//2
if nums[m] < target:
l = m+1
else:
r = m
if nums[r] != tar... | 2.984375 | 3 |
pi/Cart/main.py | polycart/polycart | 3 | 17385 | #!/usr/bin/python3
import cartinit
from kivy.app import App
from kivy.uix.screenmanager import Screen, ScreenManager, SlideTransition
from kivy.lang import Builder
from buttons import RoundedButton
cartinit.init()
# create ScreenManager as root, put all screens into
sm = ScreenManager()
sm.transition = SlideTransiti... | 2.625 | 3 |
docs.bak/test.py | goujou/CompartmentalSystems | 0 | 17386 | <reponame>goujou/CompartmentalSystems<gh_stars>0
from CompartmentalSystems import smooth_reservoir_model
from CompartmentalSystems import smooth_model_run
from CompartmentalSystems import start_distributions
| 0.980469 | 1 |
src/functions_DJTB.py | QTGTech/DJTB-Generator | 0 | 17387 | <gh_stars>0
import numpy as np
import re
"""
"""
OCC_LIMIT = 10
def load_and_parse(filepath, verbose=True, pad_to_tweets=False, tweet_length=280):
"""
Le nom est plutot equivoque. Charge le fichier txt de chemin 'filepath' et retire les artefacts de parsing
:param filepath: chemin d'acces vers le ... | 2.984375 | 3 |
src/tsp_c/__init__.py | kjudom/tsp-c | 0 | 17388 | <filename>src/tsp_c/__init__.py
from . import _tsp_c
from .tsp_c import solve_greedy
from .tsp_c import solve_SA
from .tsp_c import set_param_SA
from .tsp_c import solve_PSO | 1.109375 | 1 |
biosimulators_test_suite/results/data_model.py | Ryannjordan/Biosimulators_test_suite | 0 | 17389 | """ Data model for results of test cases
:Author: <NAME> <<EMAIL>>
:Date: 2021-01-01
:Copyright: 2021, Center for Reproducible Biomedical Modeling
:License: MIT
"""
from .._version import __version__
from ..warnings import TestCaseWarning # noqa: F401
import enum
__all__ = [
'TestCaseResultType',
'TestCaseR... | 2.65625 | 3 |
Projects/Project1/regan/regression.py | adelezaini/MachineLearning | 0 | 17390 | # The MIT License (MIT)
#
# Copyright © 2021 <NAME>, <NAME>, <NAME>
#
# 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... | 2.453125 | 2 |
habittracker/commands/list-habits.py | anjakuchenbecker/oofpp_habits_project | 2 | 17391 | <gh_stars>1-10
import json
import shelve
import sys
import os
import click
from prettytable import PrettyTable
import app_config as conf
import analytics
def get_json_out(raw_text):
"""Convert input raw text and return JSON."""
return json.dumps(raw_text, indent=4, sort_keys=False)
def ge... | 2.59375 | 3 |
src/zhinst/toolkit/helpers/shf_waveform.py | MadSciSoCool/zhinst-toolkit | 0 | 17392 | <filename>src/zhinst/toolkit/helpers/shf_waveform.py
# Copyright (C) 2020 Zurich Instruments
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import numpy as np
class SHFWaveform(object):
"""Implements a waveform for single channel.
Th... | 2.984375 | 3 |
mongoadmin/auth/forms.py | hywhut/django-mongoadmin | 0 | 17393 | <reponame>hywhut/django-mongoadmin<gh_stars>0
# from django.utils.translation import ugettext_lazy as _
# from django import forms
# from django.contrib.auth.forms import ReadOnlyPasswordHashField
#
# from mongoengine.django.auth import User
#
# from mongodbforms import DocumentForm
#
# class UserCreationForm(DocumentF... | 2.5 | 2 |
odin-libraries/python/odin_test.py | gspu/odin | 447 | 17394 | """ Runs tests for Ptyhon Odin SDK """
import unittest
from os import environ
import random
from pymongo import MongoClient
import pyodin as odin
class OdinSdkTest(unittest.TestCase):
""" Establish OdinSdkTest object """
def setUp(self):
client = MongoClient(environ.get('ODIN_MONGODB'))
mongo... | 2.5625 | 3 |
artemis/general/test_dict_ops.py | peteroconnor-bc/artemis | 235 | 17395 | from artemis.general.dict_ops import cross_dict_dicts, merge_dicts
__author__ = 'peter'
def test_cross_dict_dicts():
assert cross_dict_dicts({'a':{'aa': 1}, 'b':{'bb': 2}}, {'c': {'cc': 3}, 'd': {'dd': 4}}) == {
('a','c'):{'aa':1, 'cc':3},
('a','d'):{'aa':1, 'dd':4},
('b','c'):{'bb':2, 'c... | 2.5625 | 3 |
plur/eval/cubert_swapped_operand_classification_eval.py | VHellendoorn/plur | 52 | 17396 | <reponame>VHellendoorn/plur<filename>plur/eval/cubert_swapped_operand_classification_eval.py
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.ap... | 2.4375 | 2 |
Dynamic Programming/Paint House II.py | ikaushikpal/DS-450-python | 3 | 17397 | class Solution:
def paintHouse(self, cost:list, houses:int, colors:int)->int:
if houses == 0: # no houses to paint
return 0
if colors == 0: # no colors to paint houses
return 0
dp = [[0]*colors for _ in range(houses)]
dp[0] = cost[0]... | 3.015625 | 3 |
dufi/gui/balloontip/__init__.py | Shura1oplot/dufi | 0 | 17398 | <reponame>Shura1oplot/dufi<filename>dufi/gui/balloontip/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, print_function, absolute_import
import sys
import os
import threading
import warnings
import locale
import logging
import win32api
import win32con
impor... | 2.109375 | 2 |
ProxyIP.py | plumefox/BiliTrend | 2 | 17399 | <gh_stars>1-10
# * coding:utf-8 *
# Author : <NAME>
# Create Time : 2019/4/12
# IDE : PyCharm
# Copyright(C) 2019 <NAME>/plumefox (<EMAIL>)
# Github:https://github.com/plumefox/BiliTrend/
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | 2.140625 | 2 |