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/unit/local/lambdafn/test_config.py | torresxb1/aws-sam-cli | 859 | 25500 | <reponame>torresxb1/aws-sam-cli<filename>tests/unit/local/lambdafn/test_config.py
from unittest import TestCase
from unittest.mock import Mock
from parameterized import parameterized
from samcli.lib.utils.packagetype import ZIP
from samcli.local.lambdafn.config import FunctionConfig
from samcli.commands.local.cli_com... | 2.046875 | 2 |
pronotepy/ent/test_ent.py | Bapt5/pronotepy | 0 | 25501 | <reponame>Bapt5/pronotepy
import unittest
from inspect import getmembers, isfunction
from functools import partial
import pronotepy
from pronotepy import ent
class TestENT(unittest.TestCase):
functions: list
@classmethod
def setUpClass(cls) -> None:
cls.functions = getmembers(
ent, ... | 2.640625 | 3 |
examples/lolcode_rockstar.py | hoojaoh/rockstar | 4,603 | 25502 | <filename>examples/lolcode_rockstar.py
from rockstar import RockStar
lolcode_code = """HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE"""
rock_it_bro = RockStar(days=400, file_name='helloworld.lol', code=lolcode_code)
rock_it_bro.make_me_a_rockstar()
| 2.046875 | 2 |
src/tests/integration/test_profile_admin_view.py | pradipta/back-end | 17 | 25503 | import humps
import pytest
from django import test
from django.contrib.auth.models import User
from django.urls import reverse
def test_profile_updates_correctly(
profile_admin_client: test.Client, user: User, update_profile_params
):
url = f"{reverse('admin_update_profile')}?email={user.email}"
res = pro... | 2.390625 | 2 |
Scripts/console/script.py | sporiyano/graphiti | 93 | 25504 | <gh_stars>10-100
from Scripts import graphiti as og
from Scripts import std
from Scripts import nx
import sys
import argparse
import os.path
import glob
import fnmatch
import itertools
import random
import math
import json
class Script(object):
def __init__(self, console):
self.console = console
def run(sel... | 1.953125 | 2 |
fca/algorithms/exploration/examples/bi_unars.py | ksiomelo/cubix | 3 | 25505 | <filename>fca/algorithms/exploration/examples/bi_unars.py
#!/usr/bin/env python
# encoding: utf-8
import copy
import itertools
import fca
from fca.algorithms.exploration.exploration import (AttributeExploration,
ExplorationDB)
from fca import Implication
# from fca.... | 2.953125 | 3 |
test/Uds-Config-Tool/Profiling/test_profilingTestsOfDecodeMethods.py | J3rome/python-uds | 62 | 25506 | #!/usr/bin/env python
__author__ = "<NAME>"
__copyrights__ = "Copyright 2018, the python-uds project"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import cProfile
import sys
from functools import reduce
# ----------------------------------... | 2.109375 | 2 |
server/app/api/v2.py | chanzuckerberg/single-cell-explorer | 2 | 25507 | <reponame>chanzuckerberg/single-cell-explorer<filename>server/app/api/v2.py
import logging
from functools import wraps
from flask import (
current_app,
Blueprint,
request,
send_from_directory,
redirect,
)
from flask_restful import Api, Resource
import server.common.rest as common_rest
from server.... | 2.109375 | 2 |
marathon_acme/tests/test_cli.py | praekeltfoundation/marathon-acme | 8 | 25508 | import os
from fixtures import TempDir
from testtools import ExpectedException, TestCase, run_test_with
from testtools.assertions import assert_that
from testtools.matchers import (
Contains, DirExists, Equals, FileContains, FileExists, MatchesStructure)
from testtools.twistedsupport import (
AsynchronousDefe... | 2.109375 | 2 |
Lexical_Semantics/Repositories/Word2Vec_and_Fasttext/word2vec-and-fasttext.py | MWTA/Text-Mining | 0 | 25509 | <filename>Lexical_Semantics/Repositories/Word2Vec_and_Fasttext/word2vec-and-fasttext.py
import numpy as np
import os
import re
import urllib.request
import zipfile
import lxml.etree
from gensim.models import FastText
from random import shuffle
#download the data
urllib.request.urlretrieve(
"https://wit3.fbk.eu/ge... | 2.703125 | 3 |
Source Code/Python API/multivent_client.py | D-TACQ/acq400_lv | 0 | 25510 | #!/usr/local/bin/python
# UUT is running continuous pre/post snapshots
# subscribe to the snapshots and save all the data.
import threading
import epics
import argparse
import time
import datetime
import os
NCHAN = 16
# WF record, raw binary (shorts)
WFNAME = ":1:AI:WF:{:02d}"
# alt WF record, VOLTS. Kindof harder t... | 2.3125 | 2 |
converter.py | almehady/Convert-Bijoy-to-Unicode-File | 1 | 25511 | <filename>converter.py
from bijoy2unicode import converter
from langdetect import detect
import unicodedata
def isLineEmpty(line):
return len(line.strip()) == 0
read_file = open("bijoy.txt", "r")
write_file = open('unicode.txt', 'w')
# read_file = ["16. Òm~h©`xNj "]
for line in read_file:
if not isLineEmpty(l... | 3.140625 | 3 |
django_client_framework/models/abstract/serializable.py | kaleido-public/django-client-framework | 0 | 25512 | from __future__ import annotations
from abc import abstractmethod
from logging import getLogger
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generic,
List,
Optional,
Type,
TypeVar,
cast,
)
from django.conf import settings
from django.core.cache import cache
from django.db import ... | 2.171875 | 2 |
tests/test_util.py | KikeM/watchpoints | 0 | 25513 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/gaogaotiantian/watchpoints/blob/master/NOTICE.txt
import unittest
import inspect
from watchpoints.util import getline, getargnodes
class TestUtil(unittest.TestCase):
def test_getline(self):
... | 2.5 | 2 |
extraction/vahadane_stain_extractor.py | sebastianffx/stainlib | 3 | 25514 | <reponame>sebastianffx/stainlib<filename>extraction/vahadane_stain_extractor.py
"""
Stain normalization inspired by method of:
<NAME>., ‘Structure-Preserving Color Normalization and Sparse Stain Separation for Histological Images’, IEEE Transactions on Medical Imaging, vol. 35, no. 8, pp. 1962–1971, Aug. 2016.
Uses t... | 2.640625 | 3 |
GithubApiDemo/__init__.py | eric-nord/githubApiDemo | 0 | 25515 | """ Explicit is better than implicit """
| 1.429688 | 1 |
src/optim.py | CSI-ADS/OptimControl | 1 | 25516 | <filename>src/optim.py
from collections import defaultdict
import torch
import numpy as np
from tqdm import tqdm, trange
from .utils import *
from .loss import compute_control_from_loss
import time
def get_cl_init(N, loc=-7, scale=1e-4, vals=None, device=None):
if vals is not None:
assert N == len(vals)
... | 2.09375 | 2 |
herramientas/zapador/zapador/zapadorapp.py | ZR-TECDI/Framework_ZR | 4 | 25517 | <gh_stars>1-10
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.gridlayout import GridLayout
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
import zapador.constantes as cons
from zapador.metodos import pre_run
from zapador.clases import *
from kivy.factory import Factory
... | 2.46875 | 2 |
src/search_items/models.py | janakparajuli/Survey_Office | 0 | 25518 | <filename>src/search_items/models.py
from __future__ import unicode_literals
from django.conf import settings
from django.db import models
# Create your models here.
class Search(models.Model):
name = models.CharField(max_length=120)
link = models.CharField(max_length=120)
def __unicode__(self):
return self.n... | 1.9375 | 2 |
test/unit/agent/common/util/math.py | dp92987/nginx-amplify-agent | 308 | 25519 | # -*- coding: utf-8 -*-
from amplify.agent.common.util.math import median
from unittest import TestCase
from hamcrest import *
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
class MathTestCase(TestCase):
de... | 2.703125 | 3 |
test_code/deep_vis/deep_vis_keras.py | mikaelbj/training-visualizer | 1 | 25520 | import numpy as np
from scipy.misc import toimage
from scipy.ndimage.filters import gaussian_filter
from os import mkdir
from os.path import dirname, join
from time import time
from keras.models import Model
from keras.layers import Dense
from keras import backend as K
from keras.applications.vgg16 import VGG16
# de... | 2.453125 | 2 |
neatsociety/population.py | machinebrains/neat-society | 2 | 25521 | <gh_stars>1-10
from __future__ import print_function
import gzip
import pickle
import random
import time
import os
from neatsociety.config import Config
from neatsociety.indexer import Indexer, InnovationIndexer
from neatsociety.reporting import ReporterSet, StatisticsReporter, StdOutReporter
from neatsociety.species... | 2.734375 | 3 |
prediction/main_sementics.py | Anukriti12/OptumStratethon2.0 | 1 | 25522 | <reponame>Anukriti12/OptumStratethon2.0
import os.path
import sys
import numpy as np
import pandas as pd
import sklearn
import argparse
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import train_test_split
fr... | 2.453125 | 2 |
PLC/PRC/TPCs/tpc8/construct.py | luis1ribeiro/MEI---Majors-Degree | 1 | 25523 | import json, urllib.parse
import requests as reqs
prefixes = '''
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX noInferences: <http://www.ontotext.com/explicit>
PR... | 2.875 | 3 |
src/gaze_estimation.py | gsamueil/OpenVino-Computer-Pointer-Controller | 1 | 25524 | '''
This is a sample class for a model. You may choose to use it as-is or make any changes to it.
This has been provided just to give you an idea of how to structure your model class.
'''
import cv2
import numpy as np
import logging as log
from openvino.inference_engine import IENetwork, IECore
import warnings
import ... | 2.65625 | 3 |
api/routers/fetch.py | ThisIsBrainDamage/OSC-API | 2 | 25525 | <reponame>ThisIsBrainDamage/OSC-API<filename>api/routers/fetch.py
# Standard library imports
import os
# Third party imports
from fastapi import Depends, APIRouter, HTTPException
from dotenv import load_dotenv
# Local imports
from ..auth.classes import User
from ..auth.authenticate import get_current_active_user
from... | 2.21875 | 2 |
driver/helper/SYNHelper_Kumar.py | qgking/FRGAN | 2 | 25526 | from tumor_data.SYNDataLoader import *
from tensorboardX import SummaryWriter
from torchsummaryX import summary
from driver.helper.base_syn_helper import BaseTrainHelper
class SYNHelper_Kumar(BaseTrainHelper):
def __init__(self, generator, discriminator,
criterions, config):
super(SYNHelp... | 2.234375 | 2 |
models/wrf_hydro/ensemble_config_files/ens_setup_croton_gridded.py | hkershaw-brown/feature-preprocess | 65 | 25527 | <reponame>hkershaw-brown/feature-preprocess<gh_stars>10-100
# m=wrf_hydro_ens_sim.members[0]
# dir(m)
# Change restart frequency to hourly in hydro namelist
att_tuple = ('base_hydro_namelist', 'hydro_nlist', 'rst_dt')
# The values can be a scalar (uniform across the ensemble) or a list of length N (ensemble size).
va... | 2.046875 | 2 |
graphium/graph_management/model/access.py | graphium-project/graphium-qgis-plugin | 1 | 25528 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
QGIS plugin 'Graphium'
/***************************************************************************
*
* Copyright 2020 <NAME> @ Salzburg Research
* eMail <EMAIL>
*
* Licensed under the Apache License, Ver... | 2.015625 | 2 |
aea/cli/utils/formatting.py | bryanchriswhite/agents-aea | 126 | 25529 | <filename>aea/cli/utils/formatting.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | 2.484375 | 2 |
ocean_utils/agreements/utils.py | oceanprotocol/common-utils-py | 0 | 25530 | <gh_stars>0
"""Agreements module."""
# Copyright 2018 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
from ocean_utils.agreements.access_sla_template import ACCESS_SLA_TEMPLATE
from ocean_utils.agreements.compute_sla_template import COMPUTE_SLA_TEMPLATE
from ocean_utils.agreements.service_types impo... | 2 | 2 |
mobilenetv1.py | Monster880/pytorch_py | 0 | 25531 | import torch
import torch.nn as nn
import torch.nn.functional as F
class mobilenet(nn.Module):
def __init__(self):
super(mobilenet, self).__init__()
self.conv_1 = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU()
... | 2.578125 | 3 |
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_sweep/search_space/randint.py | dubiety/azure-sdk-for-python | 1 | 25532 | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from azure.ai.ml.constants import SearchSpace
from marshmallow import fields, post_load, pre_dump, ValidationError
from azure.ai.ml._schema... | 2.03125 | 2 |
unittest_reinvent/scoring_tests/scoring_components/pip/test_pip_caco2_efflux.py | MolecularAI/reinvent-scoring | 0 | 25533 | <filename>unittest_reinvent/scoring_tests/scoring_components/pip/test_pip_caco2_efflux.py<gh_stars>0
import os
import shutil
import unittest
from unittest.mock import MagicMock
import numpy as np
import numpy.testing as npt
import pytest
from reinvent_scoring.scoring.enums import ComponentSpecificParametersEnum
from ... | 1.953125 | 2 |
variation/normalize.py | cancervariants/variant-normalization | 1 | 25534 | <gh_stars>1-10
"""Module for Variation Normalization."""
from typing import Optional, List, Tuple, Dict
from ga4gh.vrsatile.pydantic.vrs_models import Text
from ga4gh.vrsatile.pydantic.vrsatile_models import VariationDescriptor, \
GeneDescriptor
from ga4gh.vrs import models
from ga4gh.core import ga4gh_identify
fro... | 2.265625 | 2 |
blender/arm/logicnode/math/LN_separate_xyz.py | onelsonic/armory | 2,583 | 25535 | <reponame>onelsonic/armory<filename>blender/arm/logicnode/math/LN_separate_xyz.py<gh_stars>1000+
from arm.logicnode.arm_nodes import *
class SeparateVectorNode(ArmLogicTreeNode):
"""Splits the given vector into X, Y and Z."""
bl_idname = 'LNSeparateVectorNode'
bl_label = 'Separate XYZ'
arm_section = 'v... | 2.265625 | 2 |
setup.py | Mikfr83/skyhook | 0 | 25536 | <gh_stars>0
import sys
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
# any data files that match this pattern will be included
data_files_to_include = ["*.png"]
if sys.version_info.major == 2:
try:
import PySide
requires = ['requests']
except:
r... | 1.625 | 2 |
ml3d/torch/utils/helper_torch.py | inkyusa/Open3D-ML | 447 | 25537 | <filename>ml3d/torch/utils/helper_torch.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class conv2d_transpose(nn.Module):
def __init__(self,
batchNorm,
in_planes,
out_planes,
kernel_size=1,
stride=1,
... | 2.5625 | 3 |
2020/aoc_2020_20/aoc_2020_20.py | ericcolton/AdventOfCode | 0 | 25538 | #!/usr/bin/env python3
"""
Advent of Code 2020 Day 20: Jurassic Jigsaw
https://adventofcode.com/2020/day/20
Solution by <NAME>
"""
import re
from functools import reduce
SEA_MONSTER_PROFILE = """
..................#.
#....##....##....###
.#..#..#..#..#..#..."""
class Tile:
def __init__(self, id: int, content)... | 3.40625 | 3 |
experiments/SciTail_NLI/benchmark_paraphrases_generation.py | matejklemen/paraphrase-nli | 0 | 25539 | import json
import logging
import os
import sys
from argparse import ArgumentParser
import re
import numpy as np
import pandas as pd
import torch
from transformers import GPT2Tokenizer
from src.data.cleaning import mask_not_na, inds_unique, mask_long_enough
from src.data.nli import TransformersSeqPairDataset
from src... | 2.171875 | 2 |
test.py | conema/distributed-TransE | 3 | 25540 | import numpy as np
from pyspark.sql import SparkSession
from pyspark import SparkContext, SparkConf
from TransEmodule import utils
def check_entities(x, map):
if x in map:
return map[x]
else:
return None
def calculate_rankings(rank_list):
flat = rank_list.map(lambda x: x[0]).persist()
... | 2.40625 | 2 |
Test_cases/Generated_Python/loops.py | TY-Projects/Code-Converter | 0 | 25541 | <gh_stars>0
def main () :
i = 1
fib = 1
target = 10
temp = 0
while (i < target) :
temp = fib
fib += temp
i+=1
print(fib)
return 0
if __name__ == '__main__':
main()
| 3.4375 | 3 |
unifrakturmaguntia/src/generate.py | graffitiMSX/msxpower-googlefontdirectory | 1 | 25542 | <reponame>graffitiMSX/msxpower-googlefontdirectory<gh_stars>1-10
#!/usr/bin/python
#
# With the SFDs in the current directory, run this with
# $ python generate.py
import fontforge, sys
required_version = "20090923"
if fontforge.version() < required_version:
print ("Your version of FontForge is too old - %s or newe... | 2.046875 | 2 |
xgboost-0.6-py3.6.egg/xgboost/dmlc-core/tracker/dmlc_tracker/sge.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 0 | 25543 | """Submit jobs to Sun Grid Engine."""
# pylint: disable=invalid-name
import os
import subprocess
from . import tracker
def submit(args):
"""Job submission script for SGE."""
if args.jobname is None:
args.jobname = ('dmlc%d.' % args.num_workers) + args.command[0].split('/')[-1]
if args.sge_log_dir... | 2.359375 | 2 |
Week 3/id_755/LeetCode_455_755.py | larryRishi/algorithm004-05 | 1 | 25544 | <gh_stars>1-10
class Solution:
def findContentChildren(self, g: List[int], s: List[int]) -> int:
g.sort()
s.sort()
greed_p = 0
size_p = 0
count = 0
while greed_p < len(g) and size_p < len(s):
if g[greed_p] <= s[size_p]:
count += 1
... | 2.84375 | 3 |
MindElec/examples/physics_driven/time_domain_maxwell/src/utils.py | mindspore-ai/mindscience | 3 | 25545 | <filename>MindElec/examples/physics_driven/time_domain_maxwell/src/utils.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | 2.4375 | 2 |
Code/CBEExamples.py | andreschristen/BA_Dilution_Series | 0 | 25546 | # -*- coding: utf-8 -*-
"""
Created on Mon 2018.02.28:00:00:00
@author: <NAME>
Abstrac:
Examples of experiments from different labs.
"""
##########################################################################################################################################################################... | 2.375 | 2 |
org_manager_form.py | MervmessInc/sfdx_scratch_org_builder | 0 | 25547 | <filename>org_manager_form.py<gh_stars>0
from asciimatics.widgets import (
Button,
Divider,
Frame,
Layout,
RadioButtons,
Text,
)
from asciimatics.event import KeyboardEvent, MouseEvent
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.exceptions import (
... | 2.09375 | 2 |
src/environmentbase/scripts/environmentutil.py | ion-channel/cloudformation-environmentbase | 1 | 25548 | <reponame>ion-channel/cloudformation-environmentbase
#!/usr/bin/env python
"""environmentutil.py
Utility tool helps to manage mappings and gathering data from across multiple AWS Availability zones.
Usage:
environmentutil amimap get [--aws_region <AWS_REGION>]
[--config_file <CONFIG_FILE>]
environm... | 2.03125 | 2 |
service-workers/service-worker/resources/update-max-aged-worker.py | meyerweb/wpt | 14,668 | 25549 | import time
import json
from wptserve.utils import isomorphic_decode, isomorphic_encode
def main(request, response):
headers = [(b'Content-Type', b'application/javascript'),
(b'Cache-Control', b'max-age=86400'),
(b'Last-Modified', isomorphic_encode(time.strftime(u"%a, %d %b %Y %H:%M:... | 1.914063 | 2 |
src/infrastructure/clients/provider/exchange_rate_api/drivers.py | sdediego/forex-django-clean-architecture | 8 | 25550 | <filename>src/infrastructure/clients/provider/exchange_rate_api/drivers.py
# coding: utf-8
import asyncio
from itertools import chain, repeat
from typing import List
from requests import Response
from requests.exceptions import RequestException
from src.domain.exchange_rate import CurrencyEntity, CurrencyExchangeRat... | 2.109375 | 2 |
Client/utils/listFileLumis.py | vkuznet/DBS | 8 | 25551 | from __future__ import print_function
#DBS-3 imports
import time
from dbs.apis.dbsClient import *
url="https://cmsweb.cern.ch/dbs/prod/global/DBSReader/"
#url="https://dbs3-test2.cern.ch/dbs/dev/global/DBSReader/"
# API Object
dbs3api = DbsApi(url=url)
# will throw error because no lfn or block_name provided
run_n... | 1.601563 | 2 |
src/py-opentimelineio/opentimelineio/schema/generator_reference.py | eric-with-a-c/OpenTimelineIO | 1 | 25552 | from .. core._core_utils import add_method
from .. import _otio
@add_method(_otio.GeneratorReference)
def __str__(self):
return 'GeneratorReference("{}", "{}", {}, {}, {})'.format(
self.name,
self.generator_kind,
self.parameters,
self.available_image_bounds,
self.metadata
... | 2.328125 | 2 |
ftests/nuxeo-server-gatling-tests/scripts/injector.py | aTiKhan/nuxeo | 1 | 25553 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Lesser General Public License
# (LGPL) version 2.1 which accompanies this distribution, ... | 2.234375 | 2 |
python/network-security/column.py | shivekkhurana/learning | 0 | 25554 | from random import randint
class Column(object):
def __init__(self, columns = 5):
super(Column, self).__init__()
self.columns = columns
def encrypt(self, payload):
matrix = []
payload = payload.replace(' ', '')
complete = False
while True:
row = []
... | 3.765625 | 4 |
SoftUni-Basic/first_steps_in_coding/lab/04_inches_to_centimeters.py | Darkartt/SoftUni | 0 | 25555 | inch = float(input())
centimetars = inch * 2.54
print(centimetars) | 3.328125 | 3 |
api/load_db.py | Build-Week-Post-Here-1/Data-Science | 0 | 25556 | <gh_stars>0
import os
from dotenv import load_dotenv
import sqlite3
import praw
# Create db schema
conn = sqlite3.connect('db.sqlite3')
c = conn.cursor()
c.execute('drop table if exists submissions')
c.execute('''create table submissions (
subreddit text,
subreddit_subs int,
... | 2.90625 | 3 |
Exemple/exemple.py | GouaiedYosra/mask_rcnn | 0 | 25557 | <reponame>GouaiedYosra/mask_rcnn<gh_stars>0
# example of extracting bounding boxes from an annotation file
from xml.etree import ElementTree
# function to extract bounding boxes from an annotation file
def extract_boxes(filename):
# load and parse the file
tree = ElementTree.parse(filename)
# get the root of the doc... | 2.984375 | 3 |
14_plot_target-list.py | kuntzer/SALSA-public | 1 | 25558 | ''' 14-plot_target-list.py
===============================================
AIM: Given a catalogue of objects, plots when the targets are visible according to their magnitude for a given period of time.
INPUT: files: - <orbit_id>_misc/orbits.dat
- <orbit_id>_flux/flux_*.dat
variables: see section PARAMETERS (below)... | 2.625 | 3 |
pymontecarlo_gui/results/base.py | pymontecarlo/pymontecarlo-gui | 0 | 25559 | """"""
# Standard library modules.
import csv
import io
import functools
# Third party modules.
from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
import xlsxwriter
# Local modules.
from pymontecarlo_gui.settings import SettingsBasedField
from pymontecarlo_gui.widgets.dialog import ExecutionProgressDialog... | 1.914063 | 2 |
tests/test.py | rfsaliev/light-model-transformer | 67 | 25560 | # -*- coding: UTF-8 -*-
import os
import sys
import subprocess
import argparse
import re
import configparser
import logging
import copy
import psutil
if sys.version_info[0] < 3:
import struct
import tensorflow as tf
from tensorflow.core.framework import graph_pb2
# level=logging.INFO only logging.debug info,leve... | 2.0625 | 2 |
tests/test_jenkins.py | lakiyi/aiojenkins | 19 | 25561 | import asyncio
import time
from collections import namedtuple
from http import HTTPStatus
import pytest
from aiojenkins.exceptions import JenkinsError
from aiojenkins.jenkins import Jenkins
from tests import CreateJob, get_host, get_login, get_password, is_ci_server
@pytest.mark.asyncio
async def test_invalid_host... | 2.265625 | 2 |
api.py | hale6666/drink-cli | 0 | 25562 | import requests
import json
with open("api.key") as f:
API_KEY = f.read().strip()
"""
This is for security online, so the API key is not publicized.
"""
f.close()
url='https://webdrink.csh.rit.edu/api/index.php'
def test():
"""
This is not usually called, other than for testing the API.
... | 3.421875 | 3 |
app/main/views.py | jfairf01/OrgoWebsite | 0 | 25563 | <filename>app/main/views.py
from flask import render_template, jsonify
from sqlalchemy import func
from . import main
from .. import db
from ..models import User, HighScore
@main.route('/highScore')
def highScore():
highScore = HighScore.query.order_by(HighScore.username).first()
if highScore is None:
... | 2.515625 | 3 |
src/python/rodney/misc.py | mesnardo/petibm-rollingpitching | 2 | 25564 | <filename>src/python/rodney/misc.py<gh_stars>1-10
"""Miscellaneous helper functions."""
import argparse
def parse_command_line():
"""Parse the command-line options."""
formatter_class = argparse.ArgumentDefaultsHelpFormatter
descr = 'Generic command-line parser for the rolling-piching application.'
p... | 3.15625 | 3 |
tests/test_lime.py | dianna-ai/dianna | 9 | 25565 | from unittest import TestCase
import numpy as np
import dianna
import dianna.visualization
from dianna.methods import LIME
from tests.test_onnx_runner import generate_data
from tests.utils import ModelRunner
from tests.utils import run_model
class LimeOnImages(TestCase):
def test_lime_function(self):
np.... | 2.640625 | 3 |
pyUnicodeSteganography/__init__.py | bunnylab/pyUnicodeSteganography | 2 | 25566 | import re
import pyUnicodeSteganography.zerowidth as zerowidth
import pyUnicodeSteganography.lookalikes as lookalikes
import pyUnicodeSteganography.snow as snow
import pyUnicodeSteganography.emoji as emoji
from pyUnicodeSteganography.zerowidth import zwc_4
def encode(unencoded_string, msg, method="zw", binary=False, ... | 2.984375 | 3 |
landlab/components/transport_length_diffusion/tests/test_tl_hill_diff.py | saraahsimon/landlab | 0 | 25567 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 16:52:10 2017
@author: margauxmouchene
"""
import numpy as np
import pytest
from numpy.testing import assert_almost_equal
from landlab import RasterModelGrid
from landlab.components import (
FlowAccumulator,
FlowDirectorSteepest,
Tr... | 2.3125 | 2 |
backend/app.py | HalmonLui/square-hackathon | 3 | 25568 | # import app
from flask import Flask, render_template, make_response, send_file
from flask_cors import CORS
# import custom helpers
from maplib import generate_embed
import loyaltylib as ll
app = Flask(__name__)
CORS(app)
# import declared routes
import frontenddata
@app.route('/ll')
def llfn():
ll.create_loya... | 2.15625 | 2 |
pytorch_mask_rcnn/visualize.py | zimonitrome/PyTorch-Simple-MaskRCNN | 0 | 25569 | import torch
import torch.nn.functional as F
try:
import matplotlib.pyplot as plt
except ImportError:
pass
def factor_getter(n, base):
base = base * 0.8 ** (n // 6)
i = n % 6
if i < 3:
f = [0, 0, 0]
f[i] = base
else:
base /= 2
f = [base, base, base]
f[i ... | 2.390625 | 2 |
hec_gnn/single_model/__init__.py | zlinaf/PowerGear | 8 | 25570 | <gh_stars>1-10
import sys
import os
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(ROOT_DIR) | 1.992188 | 2 |
test/Task/ImageSequence/__init__.py | paulondc/chilopoda | 2 | 25571 | from .SequenceThumbnailTaskTest import SequenceThumbnailTaskTest
| 1.023438 | 1 |
flax/tests/geometry_test.py | eevee/flax | 47 | 25572 | from flax.geometry import Blob, Point, Rectangle, Size, Span
def test_blob_create():
rect = Rectangle(origin=Point(0, 0), size=Size(5, 5))
blob = Blob.from_rectangle(rect)
assert blob.area == rect.area
assert blob.height == rect.height
def test_blob_math_disjoint():
# These rectangles look like... | 2.890625 | 3 |
generators/UGATIT/dataset/day2rain/txt_gen.py | JW9MsjwjnpdRLFw/RMT | 0 | 25573 | import os
dir = ['trainA', 'trainB', 'testA', 'testB']
for d in dir:
img_names = os.listdir(d)
f = open('list_' + d + '.txt', "w")
for img in img_names:
f.write('./' + img + '\n')
# print(img_names) | 2.90625 | 3 |
resources/libExamples/python_class/reader1.py | andy897221/Proof-of-Play-Flow-Demo | 0 | 25574 | <reponame>andy897221/Proof-of-Play-Flow-Demo
import time
from concurrent.futures import ThreadPoolExecutor
import read2
import data_class
executor = ThreadPoolExecutor(1)
executor.submit(read2.test)
print(data_class.data.a)
data_class.data.a = "reader 1 received!"
time.sleep(3)
print(data_class.data.a) | 2.875 | 3 |
slowfast/datasets/utils.py | serre-lab/pred_gn | 0 | 25575 | #!/usr/bin/env python3
import logging
import numpy as np
import time
import torch
import cv2
logger = logging.getLogger(__name__)
def retry_load_images(image_paths, retry=10, backend="pytorch"):
"""
This function is to load images with support of retrying for failed load.
Args:
image_paths (li... | 2.703125 | 3 |
malleus/client/service/call_service.py | joelgerard/malleus | 0 | 25576 | import config
from malleus.api.service.protos.bench_service_pb2 import BenchRequest
#from malleus.api.service.protos.bench_service_pb2 import BenchRequest.Datasource
from malleus.api.domain.timer import Timer
import grpc
from malleus.api.service.protos.bench_service_pb2 import BenchRequest
import malleus.api.service.p... | 2.203125 | 2 |
resolwe_bio/tests/workflows/test_chemut.py | gregorjerse/resolwe-bio | 12 | 25577 | from resolwe.flow.models import Data
from resolwe.test import tag_process
from resolwe_bio.utils.filter import filter_vcf_variable
from resolwe_bio.utils.test import BioProcessTestCase
class CheMutWorkflowTestCase(BioProcessTestCase):
@tag_process("workflow-chemut")
def test_chemut_workflow(self):
wi... | 2.015625 | 2 |
code/src/scripts/pause.py | nuvla/job-engine | 3 | 25578 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import docker
import socket
docker_client = docker.from_env()
myself = docker_client.containers.get(socket.gethostname())
myself.pause() | 1.820313 | 2 |
scripts/parchg.py | Vevn/ENVISIoN | 0 | 25579 | <filename>scripts/parchg.py<gh_stars>0
# ENVISIoN
#
# Copyright (c) 2018 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above co... | 1.453125 | 1 |
test/hello64_patch_search.py | Nicholas1126/patchkit | 0 | 25580 | <reponame>Nicholas1126/patchkit
def search_add(pt):
add_addr = pt.search('add')
print hex(add_addr) | 2.3125 | 2 |
functions/sentim-preprocess/main.py | gipfelen/Sentiment-Analysis | 0 | 25581 | <filename>functions/sentim-preprocess/main.py
import json
import re
##################################################
########## Boilerplate wrapping code #############
##################################################
# IBM wrapper
def main(args):
res = sentim_preprocess(args)
return res
# AWS wrapper
de... | 2.75 | 3 |
pixette/application.py | EXLER/pixette | 0 | 25582 | <reponame>EXLER/pixette
import logging
import os
import pygame
from pixette.scenes.admin import AdminScene
from pixette.scenes.clock import ClockScene
from pixette.scenes.currencies import CurrenciesScene
from pixette.scenes.weather import WeatherScene
class Application:
def __init__(self, device, title, resolu... | 2.40625 | 2 |
backend/app/security.py | Kwsswart/writter | 0 | 25583 | <reponame>Kwsswart/writter
import os
from bcrypt import hashpw, gensalt, checkpw
from base64 import b64encode
from hashlib import sha256
from cryptography.fernet import Fernet
e = Fernet(os.getenv("KEY"))
def encpwd(pwd):
"""
Hash pwd provided
"""
return hashpw(b64encode(sha256(pwd.encode()).diges... | 2.96875 | 3 |
zfused_maya/zfused_maya/tool/animation/studiolibrary/examples/example3.py | zhoulh0322/zfused_outsource_old | 1 | 25584 | # An example for how to lock specific folders using the lockRegExp param
import studiolibrary
if __name__ == "__main__":
# Use the studiolibrary.app context for creating a QApplication instance
with studiolibrary.app():
# Lock all folders that contain the words "icon" & "Pixar" in the path
... | 2.0625 | 2 |
djangae/contrib/googleauth/backends/base.py | sleepyjames/djangae | 467 | 25585 | <gh_stars>100-1000
"""
This is duplicated from Django 3.0 to avoid
starting an import chain that ends up with
ContentTypes which may not be installed in a
Djangae project.
"""
class BaseBackend:
def authenticate(self, request, **kwargs):
return None
@classmethod
def can_authentica... | 2.046875 | 2 |
tests/cell_fabric/test_rect.py | mabrains/ALIGN-public | 119 | 25586 | <filename>tests/cell_fabric/test_rect.py
from align.cell_fabric.transformation import Rect
def test_toList():
r = Rect( 0, 0, 1, 1)
assert r.toList() == [0, 0, 1, 1]
def test_canonical():
r = Rect( 1, 1, 0, 0)
assert r.canonical().toList() == [0, 0, 1, 1]
def test_repr():
r = Rect( 0, 0, 1, 1) ... | 2.53125 | 3 |
CALCI PROGRAM TKINTER.py | Madmaxcoder2612/Programming-Codes | 0 | 25587 | # GUI Development using Tkinter
import tkinter as tk
app = tk.Tk()
app.geometry('340x310')
app.title("Calculator")
entry = tk.Entry(app,text='0',font=('arial',20,'normal'))
entry.place(x=20,y=15)
def number(n):
if n=="C":
entry.delete(0,'end')
elif n=="ans":
k2 = entry.get()
entry.delet... | 3.71875 | 4 |
models.py | andreweskeclarke/rl_gyms | 0 | 25588 | <filename>models.py
import ipdb
import math
import numpy as np
import tensorflow as tf
# N_DIM_STATE = 4
# N_DIM_ACTIONS = 2
N_DIM_STATE = 210*160
N_DIM_ACTIONS = 9
def batch_norm_init(inits, size, name):
return tf.Variable(inits * tf.ones([size]), name=name)
def weight_init(shape, name):
return tf.Variable(... | 2.421875 | 2 |
nuclino/api.py | Vanderhoof/PyNuclino | 1 | 25589 | <filename>nuclino/api.py
import requests
from typing import List
from typing import Optional
from typing import Union
from ratelimit import limits
from .utils import sleep_and_retry
from .objects import NuclinoObject
from .objects import get_loader
BASE_URL = 'https://api.nuclino.com/v0'
class NuclinoError(Excep... | 2.734375 | 3 |
apps/base/migrations/0056_auto_20190821_1628.py | gvizquel/pyerp | 0 | 25590 | # Generated by Django 2.2.4 on 2019-08-21 20:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0055_pycron'),
]
operations = [
migrations.AlterField(
model_name='pycron',
name='model_name',
f... | 1.65625 | 2 |
tests/test_settings.py | abahnihi/kn-defaults | 2 | 25591 | <gh_stars>1-10
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.a... | 1.710938 | 2 |
0/2/2752/2752.py | chr0m3/boj-codes | 3 | 25592 | <gh_stars>1-10
numbers = list(map(int, input().split())).sort()
numbers.sort()
print(str(numbers[0]) + ' ' + str(numbers[1]) + ' ' + str(numbers[2]))
| 2.96875 | 3 |
examples/worker.py | denissmirnov/kiel | 47 | 25593 | #!/usr/bin/env python
import argparse
import logging
from tornado import gen, ioloop
from kiel.clients import GroupedConsumer
log = logging.getLogger()
parser = argparse.ArgumentParser(
description="Example grouped consumer that prints out messages it gets."
)
parser.add_argument(
"brokers", type=lambda ... | 2.28125 | 2 |
glucose_app/glicemy/apps.py | luciano-s/glucose_app | 0 | 25594 | from django.apps import AppConfig
class GlicemyConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'glicemy'
| 1.304688 | 1 |
pycancer.py | WORD559/pycancer | 0 | 25595 | <reponame>WORD559/pycancer
#!/usr/bin/env python3.6
import math
import time
import os
import pygame
from pygame.locals import *
from constants import *
from sprites import Spinner
class App():
def __init__(self,width,height,title="pygame window",icon=None):
self.running = False
self.size = (widt... | 2.734375 | 3 |
shapes_and_text.py | UPstartDeveloper/open-cv-learning | 0 | 25596 | <filename>shapes_and_text.py
import cv2
import numpy as np
# Chapter 4 - How to Draw Shapes and Text on Images
if __name__ == '__main__':
# define an "image" only a matrix
img = np.zeros((512, 512, 3), np.uint8)
# print(img) # print the numbers making up the "image" in CLI
# "Color" the whole image,... | 4.28125 | 4 |
mysite/myapp/migrations/0004_auto_20191219_1946.py | Niyy/monsterpedia | 0 | 25597 | <reponame>Niyy/monsterpedia
# Generated by Django 2.2.8 on 2019-12-19 19:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapp', '0003_auto_20191218_0740'),
]
operations = [
migrations.AlterField(
model_name='monster',
... | 1.828125 | 2 |
src/data/caf/make_data.py | tiphaine/o2-base | 0 | 25598 | import pandas as pd
from caf import source_config
from utils import write_csv_file
def _get_year(p):
"""Get year from string having the DD/MM/YEAR format."""
date_tokens = p['dtref'].split('/')
if len(date_tokens) == 3:
date_year = date_tokens[-1]
else:
date_year = None
return dat... | 3.484375 | 3 |
draco/run.py | ngehlenborg/draco | 0 | 25599 | '''
Run constraint solver to complete spec.
'''
import json
import logging
import os
import subprocess
import tempfile
from typing import Dict, List, Tuple, Optional
import clyngor
from draco.spec import Query, Task
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
DRACO_LP = ['define.lp... | 2.25 | 2 |