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 |
|---|---|---|---|---|---|---|
binarycheck.py | pnordin/trimeol | 0 | 10900 | """Module to help guess whether a file is binary or text.
Requirements:
Python 2.7+
Recommended:
Python 3
"""
def is_binary_file(fname):
"""Attempt to guess if 'fname' is a binary file heuristically.
This algorithm has many flaws. Use with caution.
It assumes that if a part of the file has NUL b... | 3.984375 | 4 |
spiketoolkit/validation/quality_metric_classes/snr.py | seankmartin/spiketoolkit | 0 | 10901 | import numpy as np
import spikemetrics.metrics as metrics
from .utils.thresholdcurator import ThresholdCurator
from .quality_metric import QualityMetric
import spiketoolkit as st
from spikemetrics.utils import Epoch, printProgressBar
from collections import OrderedDict
from .parameter_dictionaries import get_recording_... | 2.4375 | 2 |
parser/fase2/team16/main.py | webdev188/tytus | 0 | 10902 | <reponame>webdev188/tytus
# This is a sample Python script.
# Press Mayús+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import Gramatica as g
import interprete as Inter
import ts as TS
import jsonMode as JSON_INGE
imp... | 2.515625 | 3 |
stsynphot/tests/test_parser.py | tddesjardins/stsynphot_refactor | 5 | 10903 | <filename>stsynphot/tests/test_parser.py<gh_stars>1-10
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test spparser.py module, which uses spark.py.
.. note::
Only testing to see if the parser makes the right kind of
objects. Quality of the data is tested in other modules.
"""
# STDLIB
im... | 2.234375 | 2 |
rsbroker/urls.py | land-pack/RsBroker | 0 | 10904 | <gh_stars>0
from __future__ import absolute_import
import os
from tornado.web import StaticFileHandler
from rsbroker.views import websocket
from rsbroker.views.error import NotFoundErrorHandler
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.p... | 1.835938 | 2 |
tests/pheweb/load/command_flags_test.py | stellakeppo/pheweb | 4 | 10905 | <reponame>stellakeppo/pheweb<filename>tests/pheweb/load/command_flags_test.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Unit testing for command flags.
This tests the various command flags
and there helper methods.
"""
import argparse
import typing
import uuid
import pytest
from pheweb.load.command_flags import (
... | 2.53125 | 3 |
sandbox/error-correct-pass2.py | sadeepdarshana/khmer | 558 | 10906 | #! /usr/bin/env python
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2011-2015, Michigan State University.
# Copyright (C) 2015, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pro... | 1.664063 | 2 |
metadata-ingestion/tests/integration/azure_ad/test_azure_ad.py | zhoxie-cisco/datahub | 1 | 10907 | <reponame>zhoxie-cisco/datahub
import json
import pathlib
from unittest.mock import patch
from freezegun import freeze_time
from datahub.ingestion.run.pipeline import Pipeline
from datahub.ingestion.source.identity.azure_ad import AzureADConfig
from tests.test_helpers import mce_helpers
FROZEN_TIME = "2021-08-24 09:... | 2.046875 | 2 |
edit/core/optimizer/__init__.py | tpoisonooo/basicVSR_mge | 28 | 10908 | <reponame>tpoisonooo/basicVSR_mge
from .builder import build_optimizers, MGE_OPTIMIZERS, build_gradmanagers
from .default_constructor import DefaultOptimizerConstructor
| 0.972656 | 1 |
hackerrank/medium/Climbing_the_Leaderboard.py | HoussemBousmaha/Competitive-Programming | 6 | 10909 | <reponame>HoussemBousmaha/Competitive-Programming
def climbingLeaderboard(ranked, player):
ranked = sorted(list(set(ranked)), reverse=True)
ranks = []
# print(ranked)
for i in range(len(player)):
bi = 0
bs = len(ranked) - 1
index = 0
while (bi <= bs):
mid =... | 3.8125 | 4 |
src/python/config/parser/test_parsing.py | ncsa/NCSA-Genomics_MGC_GenomeGPS_CromwelWDL | 0 | 10910 | <gh_stars>0
#!/usr/bin/env python3
import unittest
from config.parser.parsing import Parser
class TestParser(unittest.TestCase):
# Create an instance of the Parser class
parser_inst = Parser(job_id="NA")
# Turn the project logger off during UnitTesting, so the end user is not confused by error messages... | 3.359375 | 3 |
scripts/aggregate_membership.py | LibrariesHacked/wuthering-hacks | 5 | 10911 | ## Requires Python v3 and pandas (pip install pandas)
## This script takes the newcastle membership csv and attempts
## to reduce the file size as much as possible through aggregation and lookups
## Two lookup files to provide library names and dates are also created.
import csv
import os
import re
from datetime impor... | 2.921875 | 3 |
mdl/contracts/contract.py | fafhrd91/mdl | 3 | 10912 | <reponame>fafhrd91/mdl
"""Interface contract object"""
from __future__ import absolute_import
import six
import sys
import logging
from contracts.interface import ContractException, ContractNotRespected
from .extension import ID
from ..declarations import implementer
from ..verify import verifyObject
from ..interface ... | 2.46875 | 2 |
hourglass/train.py | ziqi123/AutoParking | 0 | 10913 | <gh_stars>0
import numpy as np
import torch
import torchvision.transforms as transforms
from dataloader.dataloader_hourglass import heatmap_Dataloader
import os
from network import KFSGNet
import torchvision.transforms as transforms
os.environ['CUDA_VISIBLE_DEVICES'] = '2'
# Device configuration
device = torch.device... | 2.328125 | 2 |
wpa-psk/wpa-psk.py | ranisalt/rsaur | 0 | 10914 | #!/usr/bin/env python3
import sys
from argparse import ArgumentParser
from getpass import getpass
from hashlib import pbkdf2_hmac
from signal import signal, SIGINT
def die(*_, **__):
sys.exit()
signal = signal(SIGINT, die)
iwd = """[Security]
PreSharedKey={psk}"""
supplicant = """network={{
ssid={ssid}
... | 3.046875 | 3 |
cms/management/commands/subcommands/copy_lang.py | mightyiam/django-cms | 2 | 10915 | <filename>cms/management/commands/subcommands/copy_lang.py
# -*- coding: utf-8 -*-
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from cms.api import copy_plugins_to_language
from cms.models import Title, Page
from cms.utils.i18n im... | 2.21875 | 2 |
easyml/mainsite/migrations/0015_auto_20181014_1837.py | evancasey1/EasyML | 0 | 10916 | <filename>easyml/mainsite/migrations/0015_auto_20181014_1837.py
# Generated by Django 2.1.2 on 2018-10-14 18:37
from django.db import migrations
import picklefield.fields
class Migration(migrations.Migration):
dependencies = [
('mainsite', '0014_mlmodel_type_num'),
]
operations = [
migr... | 1.632813 | 2 |
adsrefpipe/refparsers/handler.py | golnazads/ADSReferencePipeline | 0 | 10917 | <filename>adsrefpipe/refparsers/handler.py
# -*- coding: utf-8 -*-
from adsrefpipe.refparsers.CrossRefXML import CrossReftoREFs
from adsrefpipe.refparsers.ElsevierXML import ELSEVIERtoREFs
from adsrefpipe.refparsers.JATSxml import JATStoREFs
from adsrefpipe.refparsers.IOPxml import IOPtoREFs
from adsrefpipe.refparsers... | 2.109375 | 2 |
src/onegov/translator_directory/layout.py | politbuero-kampagnen/onegov-cloud | 0 | 10918 | from cached_property import cached_property
from purl import URL
from onegov.translator_directory import _
from onegov.core.elements import Block, Link, LinkGroup, Confirm, Intercooler
from onegov.core.utils import linkify
from onegov.org.layout import DefaultLayout as BaseLayout
from onegov.translator_directory.colle... | 2.1875 | 2 |
src/dsanalizer/informations.py | perqu/Dataset-Analizer | 0 | 10919 | import pandas as pd
import numpy as np
import io
def info(df):
print("------------DIMENSIONS------------")
print("Rows:", df.shape[0])
print("Columns:", df.shape[1])
print("--------------DTYPES--------------")
columns = df.columns.tolist()
integers = df.select_dtypes("integer").columns.tolist(... | 3.3125 | 3 |
src/packagedcode/cargo.py | Siddhant-K-code/scancode-toolkit | 1,511 | 10920 | <reponame>Siddhant-K-code/scancode-toolkit<filename>src/packagedcode/cargo.py
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scan... | 1.859375 | 2 |
tests/testing/units.py | mandaltj/gem5_chips | 135 | 10921 | <reponame>mandaltj/gem5_chips<filename>tests/testing/units.py
#!/usr/bin/env python2.7
#
# Copyright (c) 2016 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limite... | 1.234375 | 1 |
mythic-docker/app/routes/routes.py | rmusser01/Mythic | 934 | 10922 | <reponame>rmusser01/Mythic<gh_stars>100-1000
from app import (
mythic,
links,
nginx_port,
listen_port,
mythic_admin_password,
mythic_admin_user,
default_operation_name,
mythic_db
)
import app
import asyncpg
import redis
from peewee_async import Manager
from sanic.response i... | 2.234375 | 2 |
sdl2/blendmode.py | namelivia/py-sdl2 | 222 | 10923 | <gh_stars>100-1000
from ctypes import c_int
from .dll import _bind
__all__ = [
# Enums
"SDL_BlendMode",
"SDL_BLENDMODE_NONE", "SDL_BLENDMODE_BLEND", "SDL_BLENDMODE_ADD",
"SDL_BLENDMODE_MOD", "SDL_BLENDMODE_MUL", "SDL_BLENDMODE_INVALID",
"SDL_BlendOperation",
"SDL_BLENDOPERATION_ADD", "SDL_BLEN... | 1.453125 | 1 |
python_code/cutils/viz/__init__.py | IBM/oct-glaucoma-vf-estimate | 0 | 10924 | from .vizutils import viz_overlaymask, display_side2side, display_side2sidev1, stack_patches, figure2image, get_heatmap, visualize_probmaps
from .vizutils import get_heatmap_multiple, figure2image_save | 1.039063 | 1 |
lib/site_config.py | bruceravel/xraylarch | 0 | 10925 | <filename>lib/site_config.py
#!/usr/bin/env python
"""
site configuration for larch:
init_files: list of larch files run (in order) on startup
module_path: list of directories to search for larch code
history_file:
"""
from __future__ import print_function
import sys
import os
from os.path import exists, ab... | 2.21875 | 2 |
gpath/path_similarity.py | insilichem/gpathfinder | 5 | 10926 | <reponame>insilichem/gpathfinder<filename>gpath/path_similarity.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############
# GPathFinder: Identification of ligand pathways by a multi-objective
# genetic algorithm
#
# https://github.com/insilichem/gpathfinder
#
# Copyright 2019 <NAME>, <NAME>,
# <NAME>, <NAME>,
... | 1.851563 | 2 |
Schedule/groupagenda/urls.py | f0rdream/party-time | 0 | 10927 | from django.conf.urls import url, include
from .views import (GroupListAPIView,
GroupCreateAPIView,
AgendaListAPIView,
AgendaDetailAPIView,
AgendaCreateAPIView,
AgendaPostAPIView,
agenda_create,
... | 2 | 2 |
examples/admin.py | kimbackdoo/Web-Cralwer | 0 | 10928 | from django.contrib import admin
# Register your models here.
#models에서 Shop을 임폴트
from .models import Shop
from .models import Parsed_data
from .models import Img_data
from .models import Other
admin.site.register(Shop)
admin.site.register(Parsed_data)
admin.site.register(Img_data)
admin.site.register(Other)
| 1.445313 | 1 |
main_test_dad.py | AdamLohSg/GTA | 8 | 10929 | <reponame>AdamLohSg/GTA<gh_stars>1-10
import torch
from models.gta import GraphTemporalEmbedding
if __name__ == '__main__':
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
x = torch.randn(32, 96, 122)
model = GraphTemporalEmbedding(122, 96, 3)
y = model(x)
print(y.size())
... | 2.359375 | 2 |
daiquiri_client/auth.py | aipescience/django-daiquiri-client | 0 | 10930 | class Auth():
def __init__(self, client):
self.client = client
def get_profiles(self):
return self.client.get('/auth/api/profiles/', {'page_size': 10000})['results']
def get_groups(self):
return self.client.get('/auth/api/groups/')
def get_group_map(self):
return {gro... | 2.59375 | 3 |
CSS/spiraleFile.py | NsiLycee/premiere | 0 | 10931 | '''
Auteur : <NAME>
But : tracé une figure géométrique à l'aide de la bibliothèque Turtle
Le projet utilise l'objet file pour itérer le calcul de chaque nouveau point
Les coordonnées des points d'un polygone sont placés dans une file
l'algorithme consiste à calculer les coor... | 3.84375 | 4 |
network/modules/spconv_unet.py | alexisgroshenry/NPM3D_DSNet | 0 | 10932 | # -*- coding:utf-8 -*-
# author: Xinge
# @file: spconv_unet.py
# @time: 2020/06/22 15:01
import time
import numpy as np
import spconv
import torch
import torch.nn.functional as F
from torch import nn
def conv3x3(in_planes, out_planes, stride=1, indice_key=None):
return spconv.SubMConv3d(in_planes, out_planes, ker... | 2.0625 | 2 |
scivision_test_plugin/__init__.py | acocac/scivision-test-plugin | 0 | 10933 | <reponame>acocac/scivision-test-plugin
from .model import DummyModel, ImageNetModel
| 0.957031 | 1 |
prml/dimreduction/bayesian_pca.py | andresmasegosa/PRML-CoreSets | 0 | 10934 | import numpy as np
from prml.dimreduction.pca import PCA
class BayesianPCA(PCA):
def fit(self, X, iter_max=100, initial="random"):
"""
empirical bayes estimation of pca parameters
Parameters
----------
X : (sample_size, n_features) ndarray
input data
i... | 2.984375 | 3 |
mne/time_frequency/psd.py | jnvandermeer/mne-python | 0 | 10935 | <filename>mne/time_frequency/psd.py
# Authors : <NAME>, <EMAIL> (2011)
# <NAME> <<EMAIL>>
# License : BSD 3-clause
import numpy as np
from ..parallel import parallel_func
from ..io.pick import _pick_data_channels
from ..utils import logger, verbose, _time_mask
from ..fixes import get_spectrogram
from .multi... | 2.34375 | 2 |
culturebank/models.py | Anaphory/culturebank | 0 | 10936 | <reponame>Anaphory/culturebank
from zope.interface import implementer
from sqlalchemy import (
Column,
String,
Integer,
Float,
ForeignKey,
CheckConstraint,
)
from sqlalchemy.orm import relationship, backref
from clld import interfaces
from clld.db.meta import Base, CustomModelMixin
from clld.db... | 2.15625 | 2 |
src/models/layers/feature.py | icycookies/dd_benchmark | 2 | 10937 | <filename>src/models/layers/feature.py
import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, num_features, hidden_sizes, dropout):
super().__init__()
self.layers = nn.ModuleList(
[nn.Linear(num_features, hidden_sizes[0])] +
[nn.Linear(hidden_sizes[i], h... | 3.34375 | 3 |
src/kanone/adapter/tx.py | doncatnip/kanone | 5 | 10938 | """ Twisted adapter for Kanone """
from twisted.python.failure import Failure
from twisted.internet import defer
from ..lib import Invalid
from ..util import varargs2kwargs
import logging, sys
log = logging.getLogger( __name__ )
# hacky and redundant, but it'll do for now ..
# TODO: move to proper twisted specific c... | 2.046875 | 2 |
sandbox/graph-size.py | maarten1983/khmer | 1 | 10939 | <filename>sandbox/graph-size.py
#! /usr/bin/env python2
#
# This file is part of khmer, http://github.com/ged-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2013. It is licensed under
# the three-clause BSD license; see doc/LICENSE.txt.
# Contact: <EMAIL>
#
import khmer
import sys
import screed
impo... | 2.453125 | 2 |
ferry/crawler/fetch_demand.py | coursetable/ferry | 4 | 10940 | """
Fetches demand statistics.
Modified from <NAME>
Original article:
https://yaledailynews.com/blog/2020/01/10/yales-most-popular-courses/
Github:
https://github.com/iamdanzhao/yale-popular-classes
README:
https://github.com/iamdanzhao/yale-popular-classes/blob/master/data-guide/course_data_guide.md
"""
import ar... | 3.1875 | 3 |
migrate_db.py | qxf2/interview-scheduler | 2 | 10941 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from qxf2_scheduler import models
from qxf2_scheduler import db
from qxf2_scheduler.__init__ import app
from flask_script import Manager
from flask_migrate import Migrate,MigrateCommand
migrate=Migrate(app, db,render_as_batch=True)
manager=Manager(app)
m... | 1.882813 | 2 |
main.py | tarunsinghal92/indeedscrapperlatest | 15 | 10942 | # import packages
import requests
import pandas as pd
import time
from functions import *
# limit per sity
max_results_per_city = 100
# db of city
city_set = ['New+York','Toronto','Las+Vegas']
# job roles
job_set = ['business+analyst','data+scientist']
# file num
file = 1
# from where to skip
SKIPPER = 0
# lo... | 2.984375 | 3 |
L0_serial.py | RL-WWW/ISST | 5 | 10943 | <reponame>RL-WWW/ISST<gh_stars>1-10
# Import Libraries
import numpy as np
import cv2
import argparse
import time
# Import User Libraries
import L0_helpers
# Image File Path
image_r = "images/flowers.jpg"
image_w = "out_serial.png"
# L0 minimization parameters
kappa = 2.0
_lambda = 2e-2
# Verbose output
verbose = Fa... | 2.5 | 2 |
data_processing/signal_downsampling.py | HassanHayat08/Interpretable-CNN-for-Big-Five-Personality-Traits-using-Audio-Data | 9 | 10944 | <filename>data_processing/signal_downsampling.py
### Interpretable cnn for big five personality traits using audio data ###
### This script downsamples 41000 kz signal into 4000 kz signal ###
from __future__ import absolute_import, division, print_function
import pathlib
import random
import csv
import numpy as np
fr... | 2.75 | 3 |
ai_flow/model_center/entity/_model_repo_object.py | flink-extended/ai-flow | 79 | 10945 | #
# Copyright 2022 The AI Flow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 2.015625 | 2 |
model_search/search/common_test.py | LinqCod/model_search | 0 | 10946 | <filename>model_search/search/common_test.py
# Copyright 2020 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 require... | 2.109375 | 2 |
model-builder/skrutil/deprecate_util.py | DaYeSquad/worktilerwdemo | 5 | 10947 | <reponame>DaYeSquad/worktilerwdemo
import warnings
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emmitted
when the function is used."""
def newFunc(*args, **kwargs):
warnings.simplefilter('always', DeprecationW... | 2.90625 | 3 |
models.py | sheldonjinqi/CIS680_BicycleGAN | 0 | 10948 | from torchvision.models import resnet18
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import torch
import pdb
##############################
# Encoder
##############################
class Encoder(nn.Module):
def __init__(self, latent_dim):
super(Encoder, self).__init__()
... | 2.71875 | 3 |
oem_storage_file/main.py | OpenEntityMap/oem-storage-file | 0 | 10949 | <filename>oem_storage_file/main.py<gh_stars>0
from oem_framework.models.core import ModelRegistry
from oem_framework.plugin import Plugin
from oem_framework.storage import ProviderStorage
from oem_storage_file.core.base import BaseFileStorage
from oem_storage_file.database import DatabaseFileStorage
import appdirs
imp... | 2.203125 | 2 |
scripts/slave/recipe_modules/v8/gclient_config.py | bopopescu/chromium-build | 0 | 10950 | # Copyright 2013 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 DEPS
CONFIG_CTX = DEPS['gclient'].CONFIG_CTX
ChromiumGitURL = DEPS['gclient'].config.ChromiumGitURL
@CONFIG_CTX()
def v8(c):
soln = c.solutions.ad... | 1.8125 | 2 |
parser/fase2/team28/models/Other/funcion.py | jossiebk/tytus | 0 | 10951 | from models.instructions.shared import Instruction
from models.Other.ambito import Ambito
from controllers.three_address_code import ThreeAddressCode
from controllers.procedures import Procedures
from models.instructions.Expression.expression import DATA_TYPE, PrimitiveData
class Parametro(Instruction):
def __ini... | 2.53125 | 3 |
podcast/download.py | jessstringham/podcasts | 1 | 10952 | import typing
import urllib.error
import urllib.request
from podcast.files import download_location
from podcast.info import build_info_content
from podcast.info import InfoContent
from podcast.models import Channel
from podcast.models import get_podcast_audio_link
from podcast.models import NewStatus
from podcast.mod... | 2.515625 | 3 |
tests/model/test_ocrd_page.py | j23d/core | 0 | 10953 | <gh_stars>0
from tests.base import TestCase, main, assets
from ocrd_models.ocrd_page import (
AlternativeImageType,
PcGtsType,
PageType,
TextRegionType,
TextLineType,
WordType,
GlyphType,
parseString,
parse,
to_xml
)
simple_page = """\
<PcGts xmlns="http://schema.primaresearch... | 2.125 | 2 |
athena/athena/algorithms/NetworkAnalysis/Components.py | aculich/openmappr | 19 | 10954 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 13 15:35:50 2014
@author: rich
"""
import networkx as nx
# assign component IDs to graph components, id=0 is giant component
def componentIDs(network):
# networkx algo only works on undirected network
if isinstance(network,... | 2.484375 | 2 |
tools/netconf.py | jpfluger/radiucal | 5 | 10955 | <filename>tools/netconf.py
#!/usr/bin/python
"""composes the config from user definitions."""
import argparse
import os
import users
import users.__config__
import importlib
import csv
# file indicators
IND_DELIM = "_"
USER_INDICATOR = "user" + IND_DELIM
VLAN_INDICATOR = "vlan" + IND_DELIM
AUTH_PHASE_ONE = "PEAP"
AUTH... | 2.765625 | 3 |
twitter_scrapper.py | juanlucruz/SportEventLocator | 0 | 10956 | # Import the Twython class
from twython import Twython, TwythonStreamer
import json
# import pandas as pd
import csv
import datetime
def process_tweet(tweet):
# Filter out unwanted data
d = {}
d['hashtags'] = [hashtag['text'] for hashtag in tweet['entities']['hashtags']]
try:
for key in {
... | 2.9375 | 3 |
tools/bin/filter_cassandra_attributes.py | fruch/scylla-tools-java | 0 | 10957 | #!/usr/bin/env python2
import sys;
from yaml import load, dump, load_all
from cassandra_attributes import *
def main():
attributes = dict()
for i in range(1, len(sys.argv)):
attributes.update(load(open(sys.argv[i], 'r')))
print dump(dict(filter(lambda (a, b): a in cassandra_attributes, attributes.... | 2.59375 | 3 |
ci/test_filename.py | climateamante/linode.docs | 0 | 10958 | import pytest
import itertools
# Cartesian product of file names and extensions
# e.g. README.txt, README.md, CHANGELOG.txt, CHANGELOG.md ...
file_extensions = ['txt', 'md']
names = ['README', 'CHANGELOG', 'CONTRIBUTING', 'LICENSE', 'CODE_OF_CONDUCT']
exempt_files = [('.'.join(x)) for x in itertools.product(names, fil... | 2.53125 | 3 |
test/test_sshtransport.py | stribika/sshlabs | 76 | 10959 | import sys
import unittest
sys.path.append("../main")
from sshtransport import *
class FakeSocket(object):
def __init__(self):
self.recv_buffer = b""
self.send_buffer = b""
def recv(self, n):
resp = self.recv_buffer[:n]
self.recv_buffer = self.recv_buffer[n:]
return r... | 2.828125 | 3 |
activity-classification/main_scenario_baseline.py | bstollnitz/grad-school-portfolio | 2 | 10960 | <gh_stars>1-10
import random
import time
from pathlib import Path
from typing import Dict, List, Tuple
import numpy as np
import torch
from torch.utils import data
from torch.utils.tensorboard import SummaryWriter
import utils_graph
import utils_io
import utils_nn
from feed_forward import FeedForward
from hyperparame... | 2.25 | 2 |
2020/day04/day4_part1.py | dstjacques/AdventOfCode | 0 | 10961 | <reponame>dstjacques/AdventOfCode<filename>2020/day04/day4_part1.py
input = """
ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
byr:1937 iyr:2017 cid:147 hgt:183cm
iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884
hcl:#cfa07d byr:1929
hcl:#ae17e1 iyr:2013
eyr:2024
ecl:brn pid:760753108 byr:1931
hgt:179cm
hcl:#cfa07d eyr:20... | 2.875 | 3 |
flit_core/flit_core/tests/test_common.py | rahul-deepsource/flit | 0 | 10962 | <filename>flit_core/flit_core/tests/test_common.py<gh_stars>0
import os.path as osp
from unittest import TestCase
import pytest
from flit_core.common import (
Module, get_info_from_module, InvalidVersion, NoVersionError, check_version,
normalize_file_permissions, Metadata
)
samples_dir = osp.join(osp.dirname(... | 2.296875 | 2 |
flumine/markets/market.py | jsphon/flumine | 0 | 10963 | import datetime
import logging
from typing import Optional
from betfairlightweight.resources.bettingresources import MarketBook, MarketCatalogue
from .blotter import Blotter
from ..events import events
logger = logging.getLogger(__name__)
class Market:
def __init__(
self,
flumine,
market... | 2.25 | 2 |
{{cookiecutter.project_name}}/tests/conftest.py | nelsonHolic/common-fastapi-microservice | 1 | 10964 | <filename>{{cookiecutter.project_name}}/tests/conftest.py
import pytest
from fastapi.testclient import TestClient
from {{cookiecutter.project_name}}.app import app
@pytest.fixture()
def app_client() -> TestClient:
client = TestClient(app)
return client
| 1.570313 | 2 |
scripts/naive_search.py | simonbowly/lp-generators | 9 | 10965 | <filename>scripts/naive_search.py
import itertools
import multiprocessing
import json
import numpy as np
from tqdm import tqdm
from lp_generators.features import coeff_features, solution_features
from lp_generators.performance import clp_simplex_performance
from search_operators import lp_column_neighbour, lp_row_n... | 2.59375 | 3 |
tests/test_list_.py | aefalcon/iterable_collections | 4 | 10966 | import unittest
from iterable_collections import collect
class TestList_(unittest.TestCase):
def test_list(self):
c = collect(list(range(10))).list_()
self.assertEqual(c.iterable, list(list(range(10))))
def test_set(self):
c = collect(set(range(10))).list_()
self.assertEqual... | 3.25 | 3 |
parcels/parcels/examples/example_peninsula.py | pdnooteboom/NA_forams | 1 | 10967 | <reponame>pdnooteboom/NA_forams<gh_stars>1-10
from parcels import FieldSet, ParticleSet, ScipyParticle, JITParticle, Variable
from parcels import AdvectionRK4, AdvectionEE, AdvectionRK45
from argparse import ArgumentParser
import numpy as np
import math # NOQA
import pytest
from datetime import timedelta as delta
pt... | 2.34375 | 2 |
TestBegin.py | FrankWangJQ/HttpRunner-master | 0 | 10968 | <filename>TestBegin.py<gh_stars>0
from httprunner import HttpRunner
import time
kwargs = {
"failfast":False,
#"dot_env_path": "/path/to/.env"
}
runner = HttpRunner(**kwargs)
#入口
runner.run("/Users/wangjianqing/PycharmProjects/HttpRunner-master/tests/testcases/Release/账号管理-设置项.yml")
runner.gen_html_report(h... | 1.742188 | 2 |
pyaz/synapse/sql/pool/classification/recommendation/__init__.py | py-az-cli/py-az-cli | 0 | 10969 | <filename>pyaz/synapse/sql/pool/classification/recommendation/__init__.py
'''
Manage sensitivity classification recommendations.
'''
from ...... pyaz_utils import _call_az
def list(name, resource_group, workspace_name, filter=None, included_disabled=None, skip_token=None):
'''
List the recommended sensitivity ... | 2.375 | 2 |
December Month Challenge/4KthfactorN.py | adesh-gadge/LeetCodePractice | 0 | 10970 | class Solution:
def kthFactor(self, n: int, k: int) -> int:
s1 = set()
s2 = set()
for i in range(1,int(n**0.5)+1):
if n%i ==0:
s1.add(i)
s2.add(int(n/i))
l = list(s1|s2)
l.sort()
if k > len(l):
return -1
... | 2.65625 | 3 |
dipy/utils/tests/test_arrfuncs.py | martcous/dipy | 0 | 10971 | """ Testing array utilities
"""
import sys
import numpy as np
from ..arrfuncs import as_native_array, pinv, eigh
from numpy.testing import (assert_array_almost_equal,
assert_array_equal)
from nose.tools import assert_true, assert_false, assert_equal, assert_raises
NATIVE_ORDER = '<' if ... | 2.25 | 2 |
ProgressBar.py | ArisKots1992/Similar-World-News-Articles | 1 | 10972 | # -*- coding: utf-8 -*-
import time
import sys
import math
#HOMEMADE WITHOUT ONLINE CODE by Aris
#LIENCE BY ARIS
class ProgressBar:
def __init__(self,max_size=36):
ProgressBar.max_size = max_size
ProgressBar.tick = 20.0/max_size
ProgressBar.progress_counter = 0.0
ProgressBar.counte... | 3.25 | 3 |
src/vtra/plot/rail_network_map.py | GFDRR/vietnam-transport | 3 | 10973 | <filename>src/vtra/plot/rail_network_map.py
"""Rail network map
"""
import os
import sys
from collections import OrderedDict
import cartopy.crs as ccrs
import cartopy.io.shapereader as shpreader
import matplotlib.pyplot as plt
from vtra.utils import *
def main():
config = load_config()
output_file = os.path.... | 2.546875 | 3 |
ecommerce_project/apps/ecommerce/migrations/0001_initial.py | mlopezf2019/guadalupe_sowos_examen_3 | 0 | 10974 | <gh_stars>0
# Generated by Django 3.1.1 on 2020-09-27 20:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.CreateM... | 1.789063 | 2 |
pydl/pydlspec2d/tests/test_spec1d.py | jhennawi/pydl | 0 | 10975 | <reponame>jhennawi/pydl<filename>pydl/pydlspec2d/tests/test_spec1d.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
import os
from astropy.tests.helper import raises
from astropy.utils.data import get_pkg_data_filename
from .. import Pydlspec2dException
from ... | 2.046875 | 2 |
final/good_evaluate.py | wuyuMk7/CSCI8980 | 0 | 10976 | <gh_stars>0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
from absl import flags
import numpy as np
import skimage.io as io
import cv2
import matplotlib.pyplot as plt
# import tensorflow as tf
# from psbody.mesh import Mesh
from smpl_w... | 1.710938 | 2 |
quick-scan.py | B3ND1X/py-air-script | 2 | 10977 | #!/usr/bin/python
import os
os.system("sudo ./scan.py")
os.system("sudo ./enable-wifi.py")
| 1.734375 | 2 |
src/classifier/classifier_tuning/tune_sklearn.py | krangelie/bias-in-german-nlg | 14 | 10978 | <filename>src/classifier/classifier_tuning/tune_sklearn.py
from sklearn.ensemble import RandomForestClassifier
import xgboost
def suggest_xgb(model_params, trial, xgb=None):
n_estimators = trial.suggest_int(
model_params.n_estimators.name,
model_params.n_estimators.lower,
model_params.n_es... | 2.296875 | 2 |
textgenrnn/model.py | cosandr/textgenrnn | 0 | 10979 | from keras.optimizers import RMSprop
from keras.layers import Input, Embedding, Dense, LSTM, Bidirectional, GRU
from keras.layers import concatenate, Reshape, SpatialDropout1D
from keras.models import Model
from keras import backend as K
from .AttentionWeightedAverage import AttentionWeightedAverage
def textgenrnn_mo... | 2.484375 | 2 |
tests/adapters/switches/brocade_test.py | FrancoisLopez/netman | 38 | 10980 | <gh_stars>10-100
# Copyright 2015 Internap.
#
# 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 ... | 1.6875 | 2 |
eahub/base/models.py | walambert/eahub.org | 36 | 10981 | <reponame>walambert/eahub.org
import uuid
from authtools import models as authtools_models
from django.core.validators import URLValidator
from django.db import models
from django.utils import timezone
from solo.models import SingletonModel
class User(authtools_models.AbstractEmailUser):
# django-allauth puts Go... | 2.234375 | 2 |
scripts/math/generate_matrix_test.py | chr15murray/ledger | 96 | 10982 | import numpy as np
types = ["int", "float", "double"]
def randi(*args):
return np.random.randint(-10, 10, size=args)
rngs = {"int": randi, "float": np.random.randn, "double": np.random.randn}
embodiments = {
"function": "R.%s(A,B).AllClose(C)",
"op": "(A %s B).AllClose(C)",
"inline_op": "(R = A, R ... | 2.890625 | 3 |
Lab 2/utils/inference_utils.py | davedecoder/aws-deepcomposer-samples | 6 | 10983 | <gh_stars>1-10
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# 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... | 1.820313 | 2 |
python/aisdk/player_movement.py | THUAI-Team/thuai2022-aisdk | 0 | 10984 | <gh_stars>0
from enum import Enum
from sys import stderr
class PlayerMovement(Enum):
STOPPED = 0
WALKING = 1
RUNNING = 2
SLIPPED = 3
def to_json_representation(self):
return (str(self).split('.')[1]).lower()
class MovementNotAllowedError(ValueError):
def __init__(self, message):
super().__init__(m... | 2.953125 | 3 |
diagnosticApp/admin.py | LASI-UFPI/diagnostic-imaging | 0 | 10985 | from django.contrib import admin
from .models import Image
@admin.register(Image)
class ImageAdmin(admin.ModelAdmin):
list_display = ('image', 'predict_covid', 'predict_no_findings', 'predict_pneumonia', 'created_at', 'updated_at', 'activated_at')
| 1.648438 | 2 |
digraph/source/generator.py | addy1997/python-RRT | 11 | 10986 | <reponame>addy1997/python-RRT
#!/usr/bin/env python
# coding: utf-8
# In[2]:
from time import time
import networkx as nx
from source.DiGraph import DiGraph
from source.model.Edge import Edge
def text_to_dict(filename):
in_file = open("filename", "r")
lines = in_file.read()
in_file.close()
op... | 2.90625 | 3 |
[1] BEGINNER/1000 - Hello World!.py | tiago040/URI-SOLUTIONS | 1 | 10987 | '''
https://resources.urionlinejudge.com.br/gallery/images/problems/UOJ_1000.png
Bem-vindo ao URI Online Judge!
O seu primeiro programa em qualquer linguagem de programação normalmente é o "Hello World!". Neste primeiro problema tudo o que você precisa fazer é imprimir esta mensagem na tela.
Entrada
Este problema nã... | 3.890625 | 4 |
py/py_0668_square_root_smooth_numbers.py | lcsm29/project-euler | 0 | 10988 | # Solution of;
# Project Euler Problem 668: Square root smooth Numbers
# https://projecteuler.net/problem=668
#
# A positive integer is called square root smooth if all of its prime factors
# are strictly less than its square root. Including the number $1$, there are
# $29$ square root smooth numbers not exceeding $... | 3 | 3 |
user/forms.py | Zidan-Kharisma-Sakana/uts-f02 | 0 | 10989 | from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.forms import ValidationError, EmailField
from user import models
class MyAuthenticationForm(AuthenticationForm):
... | 2.78125 | 3 |
data-structures-and-algorithms/examples/binary_tree_recursive.py | vinnyhoward/til | 0 | 10990 | class Node(object): # Similar to Linked List initial set-up
def __init__(self, value): # Constructor
self.value = value
self.left = None
self.right = None
class BinaryTree(object):
def __init__(self, root):
self.root = Node(root)
def print_tree(self, traversal_type):
... | 4.125 | 4 |
powerranger/files.py | clayboone/powerranger | 0 | 10991 | <reponame>clayboone/powerranger<gh_stars>0
import curses
import itertools
import os
from pathlib import Path
import stat
from typing import Optional, Union
import config
from colors import Colors
class Item:
"""An item inside of a Directory."""
def __init__(self, path: Union[Path, str]):
self._path =... | 2.78125 | 3 |
parlai/mturk/webapp/run_mocks/mock_turk_manager.py | lizekang/ParlAI | 1 | 10992 | <filename>parlai/mturk/webapp/run_mocks/mock_turk_manager.py
#!/usr/bin/env python3
# Copyright (c) 2017-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. An additional grant
# of patent right... | 2.03125 | 2 |
scripts/train_model.py | allenai/sledgehammer | 47 | 10993 | <gh_stars>10-100
#!/usr/bin/env python
import sys
import os
import random
import copy
import subprocess
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
# PYTHON_DIR="/".join(os.environ['CONDA_EXE'].split("/")[:-2])+'/envs/allennlp_0.8.4/bin/'
exit_threshold=0.9
def main():
parser = arg_pa... | 2.078125 | 2 |
utils/gather_files.py | letsgo247/KFG | 0 | 10994 | <reponame>letsgo247/KFG
import os
import shutil
import time
def read_all_file(path):
output = os.listdir(path)
file_list = []
for i in output:
if os.path.isdir(path+"/"+i):
file_list.extend(read_all_file(path+"/"+i))
elif os.path.isfile(path+"/"+i):
file_li... | 2.734375 | 3 |
code/diva_evaluation_cli/bin/commands/actev_get_system_subcommands/git_command.py | wenhel/Argus | 4 | 10995 | """Actev module: get-system git
Actev modules are used to parse actev commands in order to get arguments
before calling associated entry point methods to execute systems.
Warning: this file should not be modified: see src/entry_points to add your source code.
"""
from diva_evaluation_cli.bin.commands.actev_command i... | 2.59375 | 3 |
1.8.first-promise.py | senpl/course-promises | 3 | 10996 | import re
textinput = widget_inputs["text1"]
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
is_correct = False
result = re.match(".*window.*", textinput, flags=re.IGNORECASE)
if result:
is_correct = True
commentizer("You're right, but there's a little more to it... | 2.640625 | 3 |
test/test_markdown_parser.py | Asana/SGTM | 8 | 10997 | import unittest
from html import escape
from src.markdown_parser import convert_github_markdown_to_asana_xml
class TestConvertGithubMarkdownToAsanaXml(unittest.TestCase):
def test_basic_markdown(self):
md = """~~strike~~ **bold** _italic_ `code` [link](asana.com)"""
xml = convert_github_markdown_... | 3 | 3 |
ansible/my_env/lib/python2.7/site-packages/ansible/modules/network/ftd/ftd_file_upload.py | otus-devops-2019-02/yyashkin_infra | 1 | 10998 | #!/usr/bin/python
# Copyright (c) 2018 Cisco and/or its affiliates.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your ... | 1.898438 | 2 |
agent/indy_catalyst_agent/messaging/trustping/routes.py | nairobi222/indy-catalyst | 2 | 10999 | """Trust ping admin routes."""
from aiohttp import web
from aiohttp_apispec import docs
from ..connections.models.connection_record import ConnectionRecord
from .messages.ping import Ping
from ...storage.error import StorageNotFoundError
@docs(tags=["trustping"], summary="Send a trust ping to a connection")
async d... | 2.421875 | 2 |