max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tests/tests_pipeline/test_pipeline_helper.py | Anbang-Hu/shrike | 0 | 12765651 | <gh_stars>0
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""Unit tests for pipeline_helper"""
from functools import lru_cache
import pytest
import sys
from omegaconf import OmegaConf
from pathlib import Path
from shrike.pipeline import AMLPipelineHelper
import yaml
import os
import shutil... | 2.140625 | 2 |
dags/config/settings.py | geosolutions-it/getit-airflow | 1 | 12765652 | import os
from datetime import datetime, timedelta
#
# Airflow root directory
#
PROJECT_ROOT = os.path.dirname(
os.path.dirname(
os.path.dirname(__file__)
)
)
#
# Dates
#
# yesterday at beginning of day
yesterday_start = datetime.now() - timedelta(days=1)
yesterday_start = yesterday_start.replace(hour... | 2.546875 | 3 |
src/network.py | KratosOmega/NAF-tensorflow | 0 | 12765653 | <filename>src/network.py
from logging import getLogger
logger = getLogger(__name__)
import tensorflow as tf
from tensorflow.contrib.framework import get_variables
from .ops import *
class Network:
def __init__(self, sess, input_shape, action_size, hidden_dims,
use_batch_norm, use_seperate_networks,
... | 2.46875 | 2 |
simulation.py | Artisan-Lab/SMTimer | 5 | 12765654 | import time
import argparse
import numpy as np
import json
import os
import sys
# from matplotlib import pyplot
from torch.utils.data import DataLoader
from preprocessing import Constants
from util import construct_data_from_json
from dgl_treelstm.KNN import KNN
from dgl_treelstm.nn_models import *
from dgl_treelstm... | 2.375 | 2 |
setup.py | adonskoi/integrity | 0 | 12765655 | from setuptools import setup
setup(
name="integrity",
version="0.1.0",
author="<NAME>",
author_email="<EMAIL>",
packages=["integrity"],
entry_points={"console_scripts": ["integrity = integrity.__main__:main"]},
)
| 1.132813 | 1 |
.src/PyPtt/_api_get_bottom_post_list.py | PttCodingMan/ptt_post_too_many_monitor | 0 | 12765656 | from SingleLog.log import Logger
from . import data_type
from . import i18n
from . import connect_core
from . import screens
from . import exceptions
from . import command
from . import _api_util
def get_bottom_post_list(api, board):
api._goto_board(board, end=True)
logger = Logger('get_bottom_post_list', L... | 2.25 | 2 |
test/core/test_shellcode.py | LuDubies/flopz | 7 | 12765657 | <gh_stars>1-10
from flopz.core.shellcode import Shellcode
from flopz.arch.ppc.vle.e200z0 import E200Z0
from flopz.arch.ppc.vle.instructions import *
def test_basic_shellcode():
# it should be an AddressableObject
s = Shellcode()
assert(s.object_addr == 0)
# it should keep a list of instructions
a... | 2.46875 | 2 |
cdbot/cogs/maths.py | eohomegrownapps/cyberdisc-bot | 0 | 12765658 | """
Set of bot commands designed for Maths Challenges.
"""
from io import BytesIO
import aiohttp
import dateutil.parser
import httpx
from discord import Colour, Embed, File
from discord.ext import tasks
from discord.ext.commands import Bot, Cog, Context, command
from html2markdown import convert
from cdbot.constants ... | 2.75 | 3 |
pyalign/tests/__init__.py | poke1024/pyalign | 21 | 12765659 | from collections.abc import Sequence
import numpy as np
import unittest
def to_tuple(x):
if isinstance(x, Sequence):
return tuple(map(to_tuple, x))
else:
return x
class TestCase(unittest.TestCase):
def _problems(self, alphabet, sim, **kwargs):
from ..problems import general, alphabetic, binary
yield gen... | 2.921875 | 3 |
data_analyse_nba.py | xingangzhang/PythonTest | 0 | 12765660 | #!/usr/bin/python
# -*-coding:utf-8-*-
"""
@author: smartgang
@contact: <EMAIL>
@file: data_analyse_nba.py
@time: 2017/12/5 11:02
""" | 1.085938 | 1 |
web/javarailsite/learn/migrations/0013_remove_challenge_has_indent.py | wilfp/JavaRail | 2 | 12765661 | # Generated by Django 2.1.3 on 2019-03-09 13:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('learn', '0012_challenge_has_indent'),
]
operations = [
migrations.RemoveField(
model_name='challenge',
name='has_indent',
... | 1.523438 | 2 |
smartsheet/models/project_settings.py | Funtimes-Smarts/Python-import-Smart | 0 | 12765662 | <reponame>Funtimes-Smarts/Python-import-Smart
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2017 Smartsheet.com, Inc.
#
# 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... | 2.09375 | 2 |
python3/leetcodepy/n_queens_ii.py | qianbinbin/leetcode | 4 | 12765663 | <gh_stars>1-10
"""
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an integer n, return the number of distinct solutions to the n-queens puzzle.
Example 1:
Input: n = 4
Output: 2
Explanation: There are two distinct solutions to the 4-q... | 3.9375 | 4 |
Practice/Regex/Applications/Split_the_Phone_Numbers.py | alexanderbauer89/HackerRank | 1 | 12765664 | import re
def split_phone_numbers(s):
return re.split(r'[ -]', s)
for i in range(int(input())):
match = split_phone_numbers(input())
print('CountryCode=' + match[0] + ',LocalAreaCode=' + match[1] + ',Number=' + match[2])
| 3.828125 | 4 |
safe_relay_service/relay/tests/test_safe_creation_tx.py | vaporyorg/safe-relay-service | 5 | 12765665 | <gh_stars>1-10
from gnosis.safe.tests.test_safe_creation_tx import \
TestSafeCreationTx # noqa # pylint: disable=unused-import
| 1 | 1 |
services/core-api/app/api/mines/government_agencies/models/government_agency_type.py | bcgov/mds | 25 | 12765666 | from sqlalchemy.schema import FetchedValue
from app.api.utils.models_mixins import AuditMixin, Base
from app.extensions import db
class GovernmentAgencyType(AuditMixin, Base):
__tablename__ = 'government_agency_type'
government_agency_type_code = db.Column(db.String, primary_key=True)
description = db.Co... | 2.265625 | 2 |
MapsManipulations/TileSelection.py | clavlav12/RayCasting3D | 1 | 12765667 | <reponame>clavlav12/RayCasting3D
import sys
import pygame
from pygame.locals import *
from typing import List
from math import sqrt
def tile_selection_window(tiles_list: List[pygame.Surface], walls_selected=None, sprites_selected=None):
if walls_selected is None:
walls_selected = set()
if sprites_se... | 2.890625 | 3 |
tests/morse_video_threshold_decoder/test_morse_decode.py | AndrewWasHere/video-morse-decoder | 0 | 12765668 | <reponame>AndrewWasHere/video-morse-decoder<filename>tests/morse_video_threshold_decoder/test_morse_decode.py
#
# Copyright 2018 <NAME>. All rights reserved.
#
# This software is released under the BSD 3-clause license. See LICENSE.txt or
# https://opensource.org/licenses/BSD-3-Clause for more information.
#
import num... | 2.5 | 2 |
2016/18/part1.py | timofurrer/aoc-2020 | 0 | 12765669 | <reponame>timofurrer/aoc-2020
from pathlib import Path
puzzle_input_raw = (Path(__file__).parent / "input.txt").read_text()
rows = [[x == "." for x in puzzle_input_raw]]
is_trap = lambda left, center, right: not (
(not left and not center and right)
or (not center and not right and left)
or (not left ... | 2.96875 | 3 |
database/mongoDB.py | hero0926/PythonPlayground | 0 | 12765670 | # 몽고디비
from distutils.log import warn as printf
from random import randrange as rand
from pymongo import Connection, errors
from ushuffle_dbU import DBNAME, randName, FIELDS, tformat, cformat
COLLECTION = 'users'
class MongoTest(object) :
def __init__(self) :
try :
cxn = Connection()
except errors.Aut... | 2.40625 | 2 |
realestate/listing/templatetags/extra_functions.py | jinrith27/Realestate | 42 | 12765671 | <reponame>jinrith27/Realestate
from django.contrib.humanize.templatetags.humanize import intcomma
from django import template
from realestate.listing.models import Listing
register = template.Library()
@register.filter
def currency(dollars):
try:
dollars = float(dollars)
except (ValueError, TypeError... | 2.234375 | 2 |
fibber/metrics/fluency/gpt2_perplexity_metric.py | stungkit/fibber | 0 | 12765672 | <reponame>stungkit/fibber<filename>fibber/metrics/fluency/gpt2_perplexity_metric.py
"""This metric computes the perplexity ratio ppl(paraphrase) / ppl(original text).
The perplexity is estimated using GPT2 model. This metric can reveal the meaningfulness of a
sentence.
"""
import numpy as np
import torch
import torch... | 2.9375 | 3 |
src/captcha/tests/urls.py | daniel-werner/stelagifts | 108 | 12765673 | <reponame>daniel-werner/stelagifts
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'test/$','captcha.tests.views.test',name='captcha-test'),
url(r'test2/$','captcha.tests.views.test_custom_error_message',name='captcha-test-custom-error-message'),
url(r'test3/$','captcha.tests.views.t... | 1.664063 | 2 |
custom_components/nam/const.py | bieniu/ha-nettigo-air-monitor | 4 | 12765674 | <filename>custom_components/nam/const.py
"""Constants for Nettigo Air Monitor integration."""
from datetime import timedelta
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_SIGNAL_STRENGTH,
DEVICE_CLASS_TEMPERATU... | 1.953125 | 2 |
auth-api/src/auth_api/services/user.py | kvangorp/sbc-auth | 0 | 12765675 | <reponame>kvangorp/sbc-auth<gh_stars>0
# Copyright © 2019 Province of British Columbia
#
# 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
#
# U... | 1.960938 | 2 |
Region/utils.py | kirilenkobm/bioinf_stuff | 0 | 12765676 | from os import stat
class Color:
"""Color class."""
color_name_dict = {
"white": (255, 255, 255),
"black": (0, 0, 0),
"grey": (128, 128, 128),
"red": (255, 0, 0),
"blue": (0, 0, 255),
"green": (0, 255, 0)
} # TODO: continue this / maybe better colors
d... | 3.484375 | 3 |
flask_server.py | joshzarrabi/covid-publishing-api | 12 | 12765677 | """This file is the main module which contains the app.
"""
from app import create_app, db
from app.auth.auth_cli import getToken
from decouple import config
from flask.cli import AppGroup
import click
import config as configs
# Figure out which config we want based on the `ENV` env variable, default to local
from ap... | 2.46875 | 2 |
post/models.py | duhee77/Your-class-Backend | 1 | 12765678 | <gh_stars>1-10
from django.db import models
from django.conf import settings
from accounts.models import CustomUser
from subject.models import Subject
# Create your models here.
class Post(models.Model):
isNotice = models.BooleanField(default=True)
postUpdateDate = models.DateTimeField(auto_now_add=True)
... | 2.21875 | 2 |
pbpstats/data_loader/stats_nba/shots/file.py | bahalbach/pbpstats | 54 | 12765679 | import json
from pathlib import Path
from pbpstats.data_loader.abs_data_loader import check_file_directory
from pbpstats.data_loader.stats_nba.file_loader import StatsNbaFileLoader
class StatsNbaShotsFileLoader(StatsNbaFileLoader):
"""
A ``StatsNbaShotsFileLoader`` object should be instantiated and passed in... | 3.265625 | 3 |
tests/resources/wallet/test_send_tokens.py | mbnunes/hathor-core | 51 | 12765680 | <reponame>mbnunes/hathor-core
import base64
from twisted.internet.defer import inlineCallbacks
from hathor.daa import TestMode, _set_test_mode
from hathor.p2p.resources import MiningResource
from hathor.wallet.resources import BalanceResource, HistoryResource, SendTokensResource
from tests import unittest
from tests.... | 1.78125 | 2 |
server/app/services/content_element_service.py | bibbox/app-video-score | 2 | 12765681 | # -*- coding: utf-8 -*-
"""
MovieService class - This class holds the method related to User manipulations.
"""
from server.app.models.content_element import ContentElement
from server.app.services import SQLAlchemyService
from server.app import db
class ContentElementService(SQLAlchemyService):
__model__ = Con... | 2.71875 | 3 |
.github/rename.py | potassco/gringo | 0 | 12765682 | <gh_stars>0
'''
Simple helper module to be used in scripts building pip packages that depend on
clingo.
'''
import re
from os.path import isfile
def rename_clingo_cffi():
'''
Replace all occurences of 'clingo' package by 'clingo-cffi' in pip package files.
'''
for n in ('setup.py', 'pyproject.toml'):
... | 2.546875 | 3 |
test/test_vision/test_cutout.py | Fragile-azalea/homura | 1 | 12765683 | <filename>test/test_vision/test_cutout.py
import torch
from homura.vision import CutOut
def test_cutout():
input = torch.randn(3, 32, 32)
cutout = CutOut(16)
cutout(input)
| 1.695313 | 2 |
Notebooks/Assignment 3/.ipynb_checkpoints/generate_data-checkpoint.py | JRMfer/ABM_individual | 1 | 12765684 | import numpy as np
import pandas as pd
students = 250
nr_to_label = {0: 'bike', 1: 'car', 2: 'bus 40', 3: 'bus 240'}
label_to_nr = {v: k for k, v in nr_to_label.items()}
def choice(income, distance, lazy):
"""
Generate a choice based on the params
"""
if income < 500:
if distance < 8 and dist... | 3.34375 | 3 |
dataset/lfw.py | Vicent-xd/Residual_autoencoding | 432 | 12765685 | <filename>dataset/lfw.py
import os
import numpy as np
import joblib
from skimage import transform
import deeppy as dp
from .augment import (img_augment, sample_img_augment_params, AugmentedFeed,
SupervisedAugmentedFeed)
from .util import img_transform
cachedir = os.getenv('CACHE_HOME', './cache... | 2.328125 | 2 |
core/migrations/0005_auto_20210422_2040.py | Neelamegam2000/QRcode-for-license | 0 | 12765686 | # Generated by Django 3.1.7 on 2021-04-22 15:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20210414_1640'),
]
operations = [
migrations.AddField(
model_name='document',
name='... | 1.585938 | 2 |
Publish_Files_In_Google_Drive/uploadFiles.py | OseiasBeu/PYTHON_PROJECTS | 0 | 12765687 | from __future__ import print_function
import os
from apiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
from apiclient.http import MediaFileUpload
import pandas as pd
import sys
def upload_files():
try:
import argparse
flags = argpars... | 2.65625 | 3 |
src/command_modules/azure-cli-interactive/azclishell/_dump_commands.py | v-Ajnava/azure-cli | 0 | 12765688 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 2.078125 | 2 |
examples/team-fullmetal/dockerComp/src/server/config.py | connectthefuture/docker-hacks | 0 | 12765689 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
DEBUG = False
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
THREADS_PER_PAGE = 2
SECRET_KEY = ""
# Dictionary that holds all the template configuration
TEMPLATE_CONFIGURATION = {
"title" : "dockerComp DDSC (Dockerized Distributed Scienti... | 1.5 | 2 |
bridges/api/endpoints/votes.py | pegasystems/building-bridges | 20 | 12765690 | <reponame>pegasystems/building-bridges<gh_stars>10-100
import logging
from http import HTTPStatus
from typing import Dict, Tuple
from flask import request
from flask_restx import Resource
from bridges.api.endpoints.surveys import survey_api
from bridges.api.parse_args import put_question_parser
from bridges.api impor... | 2.484375 | 2 |
tests/frontend/test_lib.py | CNR-ITTIG/plasodfaxp | 1 | 12765691 | <reponame>CNR-ITTIG/plasodfaxp
# -*- coding: utf-8 -*-
"""Front-end related functions and classes for testing."""
import io
import os
import unittest
from plaso.analysis import interface as analysis_interface
class StringIOOutputWriter(object):
"""Class that implements a StringIO output writer."""
def __init__... | 2.34375 | 2 |
ruffus/test/test_follows_mkdir.py | pombreda/ruffus | 1 | 12765692 | <gh_stars>1-10
#!/usr/bin/env python
from __future__ import print_function
"""
test_follows_mkdir.py
"""
import os
import sys
# add grandparent to search path for testing
grandparent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
sys.path.insert(0, grandparent_dir)
# module name = sc... | 2.34375 | 2 |
parameters_9000.py | zhangjiannan/easyflow | 0 | 12765693 | password="<PASSWORD>(1<PASSWORD>,20,<PASSWORD>)$<PASSWORD>$28115a6960f48c6f11<PASSWORD>0bc838e9f2d622c0262"
| 0.8125 | 1 |
tests/limetr_gradient.py | rsoren/limetr | 0 | 12765694 | # test function gradient
def limetr_gradient():
import numpy as np
from limetr.__init__ import LimeTr
ok = True
# setup test problem
# -------------------------------------------------------------------------
model = LimeTr.testProblem(use_trimming=True,
use_con... | 2.5625 | 3 |
src/usecases/update/update_blog.py | lokaimoma/BLOGG | 13 | 12765695 | <filename>src/usecases/update/update_blog.py
from datetime import datetime
from typing import Callable
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from src.domain_logic.blog_domain import BlogDomain
from src.model import get_database_session
from src.model.blog import Blog
from src.u... | 2.40625 | 2 |
a2c/train.py | liuyuezhangadam/pyrl | 2 | 12765696 | from common.vec_env.vec_logger import VecLogger
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
GAMMA = 0.99
TAU = 1.00
N_STEPS = 5
CLIP_GRAD = 50
COEF_VALUE = 0.5
COEF_ENTROPY = 0.01
def train(args, venv, model, path, device):
N = args.num_pr... | 2.28125 | 2 |
_assignments/pandas/dataframe/pandas_df_groupby_a.py | sages-pl/2022-01-pythonsqlalchemy-aptiv | 0 | 12765697 | """
* Assignment: DataFrame Groupby Phones
* Complexity: easy
* Lines of code: 5 lines
* Time: 8 min
English:
1. Read data from `DATA` as `df: pd.DataFrame`
2. Give information about total number of all phone calls for each calendar month
3. Run doctests - all must succeed
Polish:
1. Wczytaj dane z `D... | 3.90625 | 4 |
models_nonconvex_simple2/waternd2.py | grossmann-group/pyomo-MINLP-benchmarking | 0 | 12765698 | # MINLP written by GAMS Convert at 08/20/20 01:30:51
#
# Equation counts
# Total E G L N X C B
# 250 105 0 145 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | 1.664063 | 2 |
layers/poky/bitbake/lib/toaster/orm/migrations/0012_use_release_instead_of_up_branch.py | dtischler/px30-test | 53 | 12765699 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.db.models import Q
def branch_to_release(apps, schema_editor):
Layer_Version = apps.get_model('orm', 'Layer_Version')
Release = apps.get_model('orm', 'Release')
print("Co... | 2.03125 | 2 |
python/deprecated/mcpat_autogen/cache.py | JimmyZhang12/predict-T | 1 | 12765700 | # Copyright (c) 2020 University of Illinois
# 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 copyright
# notice, this list of conditions and t... | 1.390625 | 1 |
db.py | Hack-OR/hackor-teams | 0 | 12765701 | <filename>db.py<gh_stars>0
#!/usr/bin/env python3
# XXX: this file is kind of a hack, but this discord bot is only gonna be used
# once, so I don't think it matters much.
import yaml
import os
db = {
'users': {}
}
def read() -> None:
global db
try:
with open('db.yml', 'r') as f:
db ... | 2.703125 | 3 |
phase2/phase2.py | somayeh-rzie/Search-Engine | 0 | 12765702 | import math
from heapq import heappop, heappush
import pickle
from itertools import islice
k=5
threshhold = 10
doc_length = {}
champion_list = {}
scores = {}
heap_flag = 1
champion_flag = 1
index_elimination_flag = 1
# set into a list
def convert(set):
return sorted(set)
#sort
def sort(list):
return sort... | 2.953125 | 3 |
2017/quals/2017-re-food/generate_flag.py | tonghuaroot/google-ctf | 2,757 | 12765703 | #!/usr/bin/python
#
# Copyright 2018 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 3.296875 | 3 |
clinvar/migrations/0007_alter_clinvar_details.py | snesic/varfish-server | 14 | 12765704 | # Generated by Django 3.2.9 on 2021-11-29 14:43
from django.db import migrations
import varfish.utils
class Migration(migrations.Migration):
dependencies = [
("clinvar", "0006_clinvarpathogenicgenes"),
]
operations = [
migrations.AlterField(
model_name="clinvar", name="detai... | 1.453125 | 1 |
gsa_framework/models/__init__.py | aleksandra-kim/gsa_framework | 2 | 12765705 | from .life_cycle_assessment import LCAModel
from .test_functions import (
Morris,
Morris4,
Borehole,
Wingweight,
OTLcircuit,
Piston,
Moon,
SobolLevitan,
SobolGstar,
SobolG,
)
from .model_base import ModelBase
from .test_functions import Morris4
| 1.132813 | 1 |
src/Modulos/dicti.py | Project-Neon/NeonSeeker | 0 | 12765706 | import pickle
dict=pickle.load(open("memoria.p","rb"))
print (dict)
| 2.171875 | 2 |
resource_emulation.py | sogeti-esec-lab/LKD | 102 | 12765707 | import ctypes
import itertools
import windows
import windows.hooks
from windows.generated_def.winstructs import *
class Ressource(object):
def __init__(self, filename, lpName, lpType):
self.filename = filename
self.lpName = lpName
self.lpType = lpType
self.driver_data = None
... | 2.09375 | 2 |
models/augmentation/__init__.py | zijian-hu/SimPLE | 36 | 12765708 | import torch
from torch import nn
from kornia import augmentation as K
from kornia import filters as F
from torchvision import transforms
from .augmenter import RandomAugmentation
from .randaugment import RandAugmentNS
# for type hint
from typing import List, Tuple, Union, Callable
from torch import Tensor
from torch... | 2.703125 | 3 |
pymoo/operators/crossover/util.py | gabicavalcante/pymoo | 11 | 12765709 | <filename>pymoo/operators/crossover/util.py
import numpy as np
def crossover_mask(X, M):
# convert input to output by flatting along the first axis
_X = np.copy(X)
_X[0][M] = X[1][M]
_X[1][M] = X[0][M]
return _X
| 3.046875 | 3 |
authors/apps/articles/apps.py | andela/ah-django-unchained | 0 | 12765710 | <filename>authors/apps/articles/apps.py
from django.apps import AppConfig
class ArticlesConfig(AppConfig):
name = 'authors.apps.articles'
def ready(self):
from authors.apps.usernotifications import handlers
| 1.46875 | 1 |
depthCompletion/utils/download_kitti_raw.py | abdo-eldesokey/evaluating_bdl | 0 | 12765711 | # code-checked
# server-checked
import os
# NOTE! NOTE! NOTE! make sure you run this code inside the kitti_raw directory (/root/data/kitti_raw)
kitti_depth_path = "/root/data/kitti_depth"
rgb_depth_path = "/root/data/kitti_rgb"
train_dirs = os.listdir(kitti_depth_path + "/train") # (contains "2011_09_26_drive_0001_s... | 2.484375 | 2 |
tests/__init__.py | sizumita/dpybrew | 1 | 12765712 | """Unit test package for dpybrew."""
| 0.898438 | 1 |
src/symmetry.py | Antoinehoff/Project_II | 0 | 12765713 | # -*- coding: utf-8 -*-
# Third party libs
import numpy
import nlopt
# Local libs
import images
from common import ProblemType
from filter import Filter
from topopt import TopoptProblem
from appearance import AppearanceCL
import solver
class Symmetric_Solver(Solver):
def design_variable_merge(self, x, nelx, ne... | 2.421875 | 2 |
echopype/echodata/combine.py | gavinmacaulay/echopype | 0 | 12765714 | import warnings
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List
import xarray as xr
from _echopype_version import version as ECHOPYPE_VERSION
from ..core import SONAR_MODELS
from ..qc import coerce_increasing_time, exist_reversed_time
from .echodata import EchoData
def unio... | 2.375 | 2 |
coding_intereview/1897. Redistribute Characters to Make All Strings Equal.py | Jahidul007/Python-Bootcamp | 2 | 12765715 | class Solution:
def makeEqual(self, words: List[str]) -> bool:
n = len(words)
words = ''.join(words)
letterCounter = Counter(words)
print(letterCounter )
for letter in letterCounter:
if letterCounter[letter] % n !=0:
return False
... | 3.53125 | 4 |
setup.py | contributor123/fuzzywuzzy | 1 | 12765716 | <filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 SeatGeek
# This file is part of fuzzywuzzy.
from fuzzywuzzy import __version__
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def open_file(fname):
return open(os.pat... | 1.460938 | 1 |
hght/__init__.py | zephenryus/botw-hght | 0 | 12765717 | <filename>hght/__init__.py
from .read_hght import read_hght
from .write_hght import write_hght, compile_hght
from .generate_map import generate_map | 1.265625 | 1 |
src/athene/rte/utils/text_processing.py | UKPLab/fever-2018-team-athene | 41 | 12765718 | <reponame>UKPLab/fever-2018-team-athene
import gzip
import os
import pickle
import re
import nltk
import numpy as np
from common.util.log_helper import LogHelper
# import torch
np.random.seed(55)
def vocab_map(vocab):
voc_dict = {}
for i, v in enumerate(vocab):
voc_dict[v] = i
# else:
# ... | 2.40625 | 2 |
flask_viewful.py | nnewman/flask-viewful | 0 | 12765719 | from dataclasses import dataclass, field
from typing import Any, Dict, Iterable, Optional, Tuple, Union
from flask import Flask, Blueprint, request, Response
from flask.views import View
from werkzeug.exceptions import MethodNotAllowed
from werkzeug.routing import Map, MapAdapter, Rule
@dataclass
class RouteMeta:
... | 2.546875 | 3 |
btclib/to_pubkey.py | pmazzocchi/btclib | 1 | 12765720 | <gh_stars>1-10
#!/usr/bin/env python3
# Copyright (C) 2017-2020 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or dis... | 2.15625 | 2 |
mapel/voting/other/matrix2png.py | szufix/mapel | 3 | 12765721 | import mapel
import mapel.voting.elections.mallows as mallows
from PIL import Image, ImageDraw
from math import sqrt
from sys import argv
def getrgb(value, MAX):
x = int(255 * value / MAX)
return (x, x, x)
def getrgb_uniform(value, MAX):
x = int(255 * value)
return (x, x, x)
def getsqrtrgb(value,... | 2.9375 | 3 |
edgepipes.py | ppi-ai/edgepipes | 2 | 12765722 | #!/usr/bin/env python3
#
# Data pipelines for Edge Computing in Python.
#
# Inspired by Google Media pipelines
#
# Dataflow can be within a "process" and then hook in locally
# But can also be via a "bus" or other communication mechanism
#
# Example: Draw detections
#
# Input 1. Picture
# Input 2. Detections [...]
#
#... | 2.828125 | 3 |
tests/api/serializers.py | TralahM/drf-generators | 340 | 12765723 | <reponame>TralahM/drf-generators
from rest_framework.serializers import ModelSerializer
from api.models import Category, Post
class CategorySerializer(ModelSerializer):
class Meta:
model = Category
fields = '__all__'
class PostSerializer(ModelSerializer):
class Meta:
model = Post
... | 2.140625 | 2 |
src/linear_search/run_linear_search_comparison.py | v-hill/advanced-computational-physics | 0 | 12765724 | <gh_stars>0
"""
This script runs a comparison between three different ways of computing
nearest-neighbours:
1) Euclidean distance
2) Euclidean distance squared
3) Manhattan distance
Points are generated in 2D.
Each program computes the neighbours of every point within a given max
distance denoted 'm... | 3.671875 | 4 |
tests/test_deduplication.py | jhnphm/boar | 0 | 12765725 | # -*- coding: utf-8 -*-
# Copyright 2010 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 2.109375 | 2 |
Python/redis.set.py | MarsBighead/mustang | 4 | 12765726 | <filename>Python/redis.set.py
#!/usr/bin/python
import redis
client = redis.Redis(host='localhost', port=6379, db=0)
if client.ping():
print "Connect to server successfully!"
else:
print "Connect to server failed!"
# Build a set myset (sadd),
# redis support add multiple, maybe python module limit it to one
... | 3.34375 | 3 |
src/views/create_chat_view.py | antkrit/chat | 0 | 12765727 | <gh_stars>0
"""Create chat view used to render index template with list of chats.
This module defines the following views:
- `create_chat_post`, POST handler for create_chat
- `create_chat_get`, GET handler for create_chat
"""
import aiohttp_jinja2
from aiohttp import web
from src.services import ChatService
from src.... | 2.4375 | 2 |
Beta/Return Even Whatever Youve Been Given.py | mwk0408/codewars_solutions | 6 | 12765728 | <gh_stars>1-10
def always_even(n): return n-n%2 | 2.265625 | 2 |
stanCode_projects/hangman game/complement.py | KevinCheng713/stanCode_project | 0 | 12765729 | """
File: complement.py
Name:鄭凱元
----------------------------
This program uses string manipulation to
tackle a real world problem - finding the
complement strand of a DNA sequence.
THe program asks uses for a DNA sequence as
a python string that is case-insensitive.
Your job is to output the complement of it.
"""
de... | 4.46875 | 4 |
bibliopixel/layout/matrix.py | rec/leds | 253 | 12765730 | import math, threading, time
from .. import colors
from .. util import deprecated, log
from . import matrix_drawing as md
from . import font
from . layout import MultiLayout
from . geometry import make_matrix_coord_map_multi
from . geometry.matrix import (
make_matrix_coord_map, make_matrix_coord_map_positions)
... | 2.578125 | 3 |
setup.py | Pierre-Thibault/neo-observer | 0 | 12765731 | <gh_stars>0
#!/usr/bin/env python
from setuptools import setup
setup(name='neo-observer',
py_modules=['neo_observer'],
packages=[],
install_requires=[],
version='1.0.1',
description='Python module implementing the observer pattern using a centralized registry',
keywords=['messaging... | 0.964844 | 1 |
Suggestions.py | harishvc/githubanalytics | 32 | 12765732 | <reponame>harishvc/githubanalytics<gh_stars>10-100
#https://github.com/seatgeek/fuzzywuzzy
#https://pypi.python.org/pypi/fuzzywuzzy/0.4.0
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
choices = ["trending now",
"top organizations",
"top contributors",
"top repositories",
... | 2.90625 | 3 |
cogs/weather.py | SQCS-TW/SQCS_bot | 0 | 12765733 | import discord
from discord.ext import commands
from core.classes import Cog_Extension
import requests
import os
data_prefix = {
"0": "天氣描述",
"1": "最高溫度",
"2": "最低溫度",
"3": "體感描述",
"4": "降水機率"
}
data_suffix = {
"0": "",
"1": "度",
"2": "度",
"3": "",
"4": "%"
}
time_range_title = {
"0": "時段一",
... | 2.828125 | 3 |
electionleaflets/apps/parties/migrations/0002_auto__add_field_party_show_on_add_page.py | electionleaflets/electionleaflets | 0 | 12765734 | <gh_stars>0
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Party.show_on_add_page'
db.add_column(u'party', 'show_on_add_page', self.gf('d... | 2.15625 | 2 |
2020/13/13a.py | befeleme/aoc | 3 | 12765735 | import fileinput
contents = [x.strip() for x in fileinput.input()]
departure = int(contents[0])
buses = contents[1].split(",")
# dummy big value to start with comparing
closest = 10000000000000000
for bus in buses:
if bus != "x":
bus = int(bus)
next_cycle = ((departure // bus) * bus + bus) - depa... | 3.40625 | 3 |
DBOperation/DBSQLite.py | jcg/d-tailor | 14 | 12765736 | <reponame>jcg/d-tailor<filename>DBOperation/DBSQLite.py
'''
Created on Nov 1, 2012
@author: jcg
'''
from DBOperation.DBAbstract import DBAbstract
from sqlite3 import connect,Row
from time import strftime
from math import sqrt
from random import choice
from uuid import uuid4
from subprocess import check_output
from so... | 2.296875 | 2 |
python/geo_calculator/src/planets.py | JEsperancinhaOrg/geo-calculator | 0 | 12765737 | <reponame>JEsperancinhaOrg/geo-calculator
EARTH = 6371000
MOON = 1737100
MARS = 3389500
JUPITER = 69911000
| 1.539063 | 2 |
texts/extraction/frame_based/process.py | nicolay-r/frame-based-attitude-extraction-workflow | 0 | 12765738 | <filename>texts/extraction/frame_based/process.py<gh_stars>0
# -*- coding: utf-8 -*-
from core.evaluation.labels import Label
from texts.readers.utils import NewsInfo
from texts.extraction.base import TextProcessor
from texts.extraction.frame_based.obj_auth import TextObjectAuthorizer
from texts.extraction.frame_based.... | 2.078125 | 2 |
hello.py | sandipsahajoy/CMPUT404-Lab3 | 0 | 12765739 | <gh_stars>0
#!/usr/bin/env python3
import os, json
### Print python env variables as plain text
# print("Content-Type: text/plain")
# print()
# print(os.environ)
### Print python env variables as json
# print("Content-Type: application/json")
# print()
# print(json.dumps(dict(os.environ), indent=2))
### Print query... | 2.640625 | 3 |
ultra/learning_algorithm/pdgd.py | lfsblack/ULTRA | 1 | 12765740 | """Training and testing the Pairwise Differentiable Gradient Descent (PDGD) algorithm for unbiased learning to rank.
See the following paper for more information on the Pairwise Differentiable Gradient Descent (PDGD) algorithm.
* Oosterhuis, Harrie, and <NAME>. "Differentiable unbiased online learning to rank." I... | 3.09375 | 3 |
src/morphforgecontrib/simulation/channels/util.py | mikehulluk/morphforge | 1 | 12765741 | <reponame>mikehulluk/morphforge
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fo... | 1.289063 | 1 |
features/base_hist.py | zerebom/Elo-merchant-category-recomendation | 0 | 12765742 | <gh_stars>0
import argparse
import inspect
import re
from abc import ABCMeta, abstractmethod
from pathlib import Path
import pandas as pd
from utils.__init__ import timer
def get_arguments_hist():
#パーサーインスタンスがを作成する
parser = argparse.ArgumentParser()
#overwriteする引数を与えている
parser.add_argument(
... | 2.34375 | 2 |
src/gcardvault.py | rtomac/gcardvault | 0 | 12765743 | <gh_stars>0
import os
import glob
import requests
import pathlib
from getopt import gnu_getopt, GetoptError
from xml.etree import ElementTree
from googleapiclient.discovery import build
from .google_oauth2 import GoogleOAuth2
from .git_vault_repo import GitVaultRepo
from .etag_manager import ETagManager
# Note: OAut... | 2.15625 | 2 |
yacht/__init__.py | IusztinPaul/yacht | 5 | 12765744 | from enum import Enum
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, Yacht"
__credits__ = ["<NAME>"]
__license__ = "Apache-2.0"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
class Mode(Enum):
Download = 'download'
ExportActions = 'export_actions'
... | 2.46875 | 2 |
osa-ironic-ui/osaui/__main__.py | neillc/junkcode | 0 | 12765745 | <reponame>neillc/junkcode<filename>osa-ironic-ui/osaui/__main__.py
import subprocess
import click
import pyrax
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
server = None
@click.command()
@click.option(
... | 2.203125 | 2 |
RecoHI/HiTracking/python/HIPixelVertices_cff.py | ckamtsikis/cmssw | 852 | 12765746 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# pixel cluster vertex finder
from RecoHI.HiTracking.HIPixelClusterVertex_cfi import *
# pixel track producer
from RecoHI.HiTracking.HIPixel3ProtoTracks_cfi import *
# fast vertex finding
from RecoHI.HiTracking.HIPixelMedianVertex_cfi import *
# s... | 0.964844 | 1 |
atom/nucleus/python/nucleus_api/models/account_overview_vo.py | sumit4-ttn/SDK | 0 | 12765747 | <reponame>sumit4-ttn/SDK<filename>atom/nucleus/python/nucleus_api/models/account_overview_vo.py
# coding: utf-8
"""
Hydrogen Atom API
The Hydrogen Atom API # noqa: E501
OpenAPI spec version: 1.7.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import ppri... | 1.585938 | 2 |
backend/src/namespaces/word_guessing/__init__.py | didi/MeetDot | 6 | 12765748 | <reponame>didi/MeetDot
from .namespace import WordGuessingNamespace
| 0.996094 | 1 |
zentral/contrib/inventory/migrations/0023_puppetdb.py | arubdesu/zentral | 634 | 12765749 | <reponame>arubdesu/zentral<filename>zentral/contrib/inventory/migrations/0023_puppetdb.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-15 13:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrat... | 1.679688 | 2 |
Algorithm/LeetCode/188_best_time_to_buy_and_sell_stock_iv.py | hqzhang83/Everything101 | 0 | 12765750 | """
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/
You are given an integer array prices where prices[i] is the price of a given stock on the ith day.
Design an algorithm to find the maximum profit. You may complete at most k transactions.
Notice that you may not engage in multiple transactions ... | 3.65625 | 4 |