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 |
|---|---|---|---|---|---|---|
features/steps/config.py | wooga/karajan | 0 | 28200 | #
# Copyright 2017 Wooga GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute... | 1.875 | 2 |
hexa/plugins/connector_postgresql/tests/test_models.py | qgerome/openhexa-app | 4 | 28201 | from django import test
from hexa.user_management.models import Membership, Team, User
from ..models import Database, DatabasePermission, Table
class PermissionTest(test.TestCase):
@classmethod
def setUpTestData(cls):
cls.DB1 = Database.objects.create(
hostname="host", username="user", p... | 2.484375 | 2 |
bcs-ui/backend/tests/components/test_bcs_api.py | kayinli/bk-bcs | 1 | 28202 | <reponame>kayinli/bk-bcs
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not u... | 1.875 | 2 |
myproject/myproject/apps/sample/urls.py | gabfl/sample-django | 1 | 28203 | from django.urls import path
from . import views
urlpatterns = [
path('', views.index),
path('hello', views.hello),
path('world', views.world),
path('users', views.users),
path('user/<int:user_id>', views.user),
]
| 1.757813 | 2 |
CPGAN/options.py | xiangsheng1325/CPGAN | 0 | 28204 | <filename>CPGAN/options.py
class SimpleOpt():
def __init__(self):
self.method = 'cpgan'
self.max_epochs = 100
self.graph_type = 'ENZYMES'
self.data_dir = './data/facebook.graphs'
self.gpu = '2'
self.lr = 0.003
self.encode_size = 16
self.decode_size = 1... | 2.71875 | 3 |
ops/data_utils.py | lunasara/learning3d | 0 | 28205 | <reponame>lunasara/learning3d<filename>ops/data_utils.py
import torch
def mean_shift(template, source, p0_zero_mean, p1_zero_mean):
template_mean = torch.eye(3).view(1, 3, 3).expand(template.size(0), 3, 3).to(template) # [B, 3, 3]
source_mean = torch.eye(3).view(1, 3, 3).expand(source.size(0), 3, 3).to(source) ... | 2.0625 | 2 |
test/test_igp_shortcuts.py | tim-fiola/network_traffic_modeler_py3 | 102 | 28206 | <filename>test/test_igp_shortcuts.py
import unittest
from pyNTM import FlexModel
from pyNTM import ModelException
from pyNTM import PerformanceModel
class TestIGPShortcuts(unittest.TestCase):
def test_traffic_on_shortcut_lsps(self):
"""
Verify Interface and LSP traffic when IGP shortcuts enabled
... | 2.515625 | 3 |
Cracking the Coding Interview/ctci-solutions-master/ch-06-math-and-logic-puzzles/07-the-apocalypse.py | nikku1234/Code-Practise | 9 | 28207 | <reponame>nikku1234/Code-Practise<filename>Cracking the Coding Interview/ctci-solutions-master/ch-06-math-and-logic-puzzles/07-the-apocalypse.py
# What will the gender ratio be after every family stops having children after
# after they have a girl and not until then.
def birth_ratio():
# Everytime a child is born, ... | 3.546875 | 4 |
tests/test_transform_identity.py | dlshriver/Queryable | 5 | 28208 | import unittest
from pinq.transforms import identity
class predicate_true_tests(unittest.TestCase):
def test_identity_int(self):
self.assertEqual(identity(123), 123)
def test_identity_str(self):
self.assertEqual(identity("apple"), "apple")
def test_identity_list(self):
self.asse... | 2.90625 | 3 |
Leet-Code/Container-With-Most-Water.py | aminzayer/My-Python-Code | 2 | 28209 | # You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are(i, 0) and (i, height[i]).
# Find two lines that together with the x-axis form a container, such that the container contains the most water.
# Return the maximum amount of water a conta... | 4.03125 | 4 |
ssseg/modules/models/encnet/encoding.py | skydengyao/sssegmentation | 1 | 28210 | <reponame>skydengyao/sssegmentation<gh_stars>1-10
'''
Function:
define the Encoding Layer: a learnable residual encoder
Author:
<NAME>
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
'''Encoding Layer'''
class Encoding(nn.Module):
def __init__(self, channels, num_codes):
sup... | 2.703125 | 3 |
examples/quiet.py | NiumXp/slog | 0 | 28211 | import slog
slog.quiet("debbug")
slog.debbug("Hi!")
slog.warning("Debbug?")
slog.unquiet()
slog.debbug("Aaaaaaaaa")
with slog.quiet("debbug"):
slog.debbug("Hello!")
slog.info("Hi!")
slog.info("Debbug?")
slog.debbug("Hey.")
| 2.3125 | 2 |
features.py | sethnabarro/stance-detector | 0 | 28212 | <reponame>sethnabarro/stance-detector<filename>features.py<gh_stars>0
# coding=utf-8
"""Functions for calculation of features"""
from nltk import sentiment, tokenize
import numpy as np
import pandas as pd
from sklearn.feature_extraction import text as text_sk
from sklearn import preprocessing as preprocessing_sk
impor... | 3.015625 | 3 |
bflib/sizes.py | ChrisLR/BasicDungeonRL | 3 | 28213 | <filename>bflib/sizes.py
from enum import Enum
class Size(Enum):
VerySmall = "Very Small"
Small = "Small"
Medium = "Medium"
Large = "Large"
Huge = "Huge"
feet_map = {
Size.VerySmall: 1,
Size.Small: 3,
Size.Medium: 5,
Size.Large: 10,
Size.Huge: 20,
}
def size_in_feet(size):
... | 3.1875 | 3 |
setup.py | davidjurgens/support | 4 | 28214 | import setuptools
import os
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="supportr",
version="0.1",
author="<NAME> and <NAME>",
author_email="<EMAIL>",
description="Supportr",
long_description=long_description,
long_description_content_type="te... | 1.445313 | 1 |
src/utils/common.py | neerajbafila/TransferLearning-pytorch | 0 | 28215 | import logging
import os
from zipfile import ZipFile
import yaml
from pathlib import Path
logging.basicConfig(
filename=os.path.join("Logs", "running.log"),
format="[%(asctime)s: %(module)s: %(levelname)s]: %(message)s",
level=logging.INFO,
filemode="a"
)
def read_yaml(config_path):
with open(conf... | 2.703125 | 3 |
svc/ivoiriansAPI.py | Ivoirians/hour-a-day | 0 | 28216 | <filename>svc/ivoiriansAPI.py
import os
import redis
import code
import urlparse
import json
from werkzeug.wrappers import Request, Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.wsgi import SharedDataMiddleware
from werkzeug.utils import redirect
f... | 2.09375 | 2 |
bin/val2rank.py | MichaelMW/crispy | 1 | 28217 | #!/usr/bin/env python
##### convert values to ranks, tie breaker as average #####
from __future__ import division
from sys import argv, stdin, stdout
from signal import signal, SIGPIPE, SIG_DFL
import argparse
signal(SIGPIPE, SIG_DFL)
# parse args
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--inVal... | 2.890625 | 3 |
SAplatform/SAcore/migrations/0009_auto_20190529_2231.py | ThankPan/SA_Backend | 2 | 28218 | # Generated by Django 2.0.6 on 2019-05-29 14:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('SAcore', '0008_user_avator'),
]
operations = [
migrations.AlterField(
model_name='user',
name='avator',
... | 1.59375 | 2 |
crons/tests/test_CLI_system_stats.py | j9ac9k/navitron | 2 | 28219 | """test_CLI_system_stats.py: tests expected behavior for CLI application"""
from os import path
import pytest
from plumbum import local
import pandas as pd
import navitron_crons.exceptions as exceptions
import navitron_crons._version as _version
import navitron_crons.navitron_system_stats as navitron_system_stats
im... | 2.40625 | 2 |
examples/example_envSampling.py | zmorrell-sand/WDRT | 0 | 28220 | import numpy as np
import WDRT.ESSC as ESSC
import copy
import matplotlib.pyplot as plt
# Create buoy object, in this case for Station #46022
buoy46022 = ESSC.Buoy('46022', 'NDBC')
# Read data from ndbc.noaa.gov
#buoy46022.fetchFromWeb()
#buoy46022.saveAsTxt(savePath = "./Data")
#buoy46022.saveAsH5('NDBC46022.h5')
#... | 2.875 | 3 |
beamr/parsers/generic.py | teonistor/py-beams | 3 | 28221 | <gh_stars>1-10
'''
Functionality common to all parsers
Created on 1 Feb 2018
@author: <NAME>
@copyright: 2018 <NAME>
@license: MIT License
'''
from beamr.debug import warn
def p_nil(p): # An empty production
'nil :'
pass
def p_error(t): # Parsing error
try:
warn("Syntax error at token v... | 1.8125 | 2 |
forklib/iterator.py | leenr/forklib | 0 | 28222 | import pickle
import struct
from contextlib import ExitStack
from tempfile import NamedTemporaryFile
from .forking import fork, get_id
def skip(iterable, skip, shift):
for idx, item in enumerate(iterable):
if idx % skip != shift:
continue
yield item
_HEADER_FORMAT = '>Q'
_HEADER_SIZE... | 2.5 | 2 |
st201712-1.py | terry-gjt/csp_python | 1 | 28223 | <gh_stars>1-10
# 最小差值
# 给定n个数,请找出其中相差(差的绝对值)最小的两个数,输出它们的差值的绝对值。
def st171201():
n= int(input())
numbers = list(map(int, input().split()))
numbers.sort()
# print(numbers)
before=numbers[1]
temp = abs(before-numbers[0])
for i in numbers[2:]:
# print(temp,before,i,abs(i-before))
... | 3.5625 | 4 |
niaaml_gui/progress_bar.py | zStupan/NiaAML-GUI | 2 | 28224 | from PyQt5 import QtCore
from PyQt5.QtWidgets import QProgressBar
class ProgressBar(QProgressBar):
def __init__(self):
super(ProgressBar, self).__init__()
self.setTextVisible(True)
self.setMaximum(100)
self.setAlignment(QtCore.Qt.AlignCenter) | 2.6875 | 3 |
virtualenv_tools.py | benbariteau/virtualenv-tools | 0 | 28225 | #!/usr/bin/env python
"""
move-virtualenv
~~~~~~~~~~~~~~~
A helper script that moves virtualenvs to a new location.
It only supports POSIX based virtualenvs and at the moment.
:copyright: (c) 2012 by Fireteam Ltd.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_f... | 2.25 | 2 |
icq/event.py | azalio/python-icq-bot | 0 | 28226 | from enum import Enum
class EventType(Enum):
MY_INFO = "myInfo"
PRESENCE = "presence"
BUDDY_LIST = "buddylist"
TYPING = "typing"
IM = "im"
DATA_IM = "dataIM"
CLIENT_ERROR = "clientError"
SESSION_ENDED = "sessionEnded"
OFFLINE_IM = "offlineIM"
SENT_IM = "sentIM"
SEND_DATA_IM... | 2.953125 | 3 |
AwsGameKit/Resources/cloudResources/functions/gamesaving/UpdateSlotMetadata/index.py | aws/aws-gamekit-unreal | 17 | 28227 | <filename>AwsGameKit/Resources/cloudResources/functions/gamesaving/UpdateSlotMetadata/index.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import boto3
import botocore
import logging
import os
import urllib.parse
from typing import Any
from gamekithelpers ... | 1.96875 | 2 |
SimTracker/TrackerMaterialAnalysis/test/listGroups.py | SWuchterl/cmssw | 6 | 28228 | from __future__ import print_function
#! /usr/bin/env cmsRun
import sys
import FWCore.ParameterSet.Config as cms
from SimTracker.TrackerMaterialAnalysis.trackingMaterialVarParsing import options
process = cms.Process("MaterialAnalyser")
if options.geometry == 'run2':
process.load('Configuration.Geometry.Geometr... | 1.789063 | 2 |
src/main/resources/test/test_python_server.py | BlindConferenceCode/s-RDF2vec | 0 | 28229 | <reponame>BlindConferenceCode/s-RDF2vec
# This unit test checks the python_server.py
# Run `pytest` in the root directory of the jRDF2vec project (where the pom.xml resides).
import threading
import python_server as server
import time
import requests
from pathlib import Path
uri_prefix = "http://localhost:1808/"
c... | 2.515625 | 3 |
SOLVED/counting-bits.py | Roxxum/Coding-Challenges | 0 | 28230 | <reponame>Roxxum/Coding-Challenges<filename>SOLVED/counting-bits.py
"""
Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.
Â
Example 1:
Input: n = 2
Output: [0,1,1]
Explanation:
0 --> 0
1 --> 1
2 --> 10
Example 2:
... | 3.640625 | 4 |
tests/test_contributors.py | chfw/gease | 1 | 28231 | <reponame>chfw/gease
from mock import MagicMock, patch
from nose.tools import eq_
from gease.contributors import EndPoint
from gease.exceptions import NoGeaseConfigFound
class TestPublish:
@patch("gease.contributors.get_token")
@patch("gease.contributors.Api.get_public_api")
def test_all_contributors(sel... | 2.15625 | 2 |
visualizations/urls.py | IlyaLab/ISB-LSDF | 0 | 28232 | """
Copyright 2015, Institute for Systems Biology
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... | 1.578125 | 2 |
temp/oldFiles/provaCursorsTweet.py | JeyDi/Mispelling | 1 | 28233 | <reponame>JeyDi/Mispelling<gh_stars>1-10
import tweepy
import re
import string
# Consumer keys and access tokens, used for OAuth
consumer_key = "P5wTozEUuNOAJCXMajGnRcDs2"
consumer_secret = "<KEY>"
access_token = "<KEY>"
access_token_secret = "<KEY>"
# OAuth process, using the keys and tokens
auth = tweepy.OAuthHandl... | 3.234375 | 3 |
tools/test_balloon_dataset.py | superclass-FSIS/test | 45 | 28234 | <gh_stars>10-100
import json
import os
import cv2
import numpy as np
import dutils.imageutils as diu
import dutils.learnutils as dlu
import torch, torchvision
import dutils.simpleutils as dsu
from detectron2.utils.logger import setup_logger
from detectron2.utils import comm
from detectron2 import model_zoo
from detect... | 2.203125 | 2 |
src/data_processing/results_visualization.py | YoavLotem/NeuriteOutgrowth | 1 | 28235 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def get_location(well_name, char2num):
"""
calculates for a well's name its row and column indices in an array that represents the plate.
Parameters
----------
well_name: str
the name of the well in the... | 3.5625 | 4 |
bindings/java/gen_jni.py | protocols-comnet/openwebrtc | 1 | 28236 | #!/usr/bin/env python -B
# Copyright (c) 2014, Ericsson AB. 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 copyright notice, this
# list... | 1.296875 | 1 |
azdashboard/config/environments/production.py | alinlacea/azdashboard | 0 | 28237 | # server backend
server = 'cherrypy'
# debug error messages
debug = False
# auto-reload
reloader = False
# database url
db_url = 'postgresql://user:pass@localhost/dbname'
# echo database engine messages
db_echo = False
| 1.335938 | 1 |
test/functional_requirements/fault_tolerance/REBUILD_TRIGGERED_RIGHT_AFTER_ARRAY_MOUNTED.py | so931/poseidonos | 38 | 28238 | #!/usr/bin/env python3
import subprocess
import os
import sys
sys.path.append("../")
sys.path.append("../../system/lib/")
sys.path.append("../array/")
import json_parser
import pos
import pos_util
import cli
import api
import json
import time
import CREATE_ARRAY_BASIC
ARRAYNAME = CREATE_ARRAY_BASIC.ARRAYNAME
def exec... | 2.125 | 2 |
newspaper/newspaper/news/managers.py | luisfer85/newspaper | 0 | 28239 | <reponame>luisfer85/newspaper
from datetime import datetime
from django.db import models
from django.db.models.query import QuerySet
class BaseNewsQuerySet(QuerySet):
def published(self):
return self.filter(publish_date__lte=datetime.now()).order_by('publish_date')
class BaseNewsManager(mo... | 2.453125 | 2 |
pygem/oggm_compat.py | lilianschuster/PyGEM | 0 | 28240 | <gh_stars>0
from oggm import cfg, utils
from oggm import workflow
from oggm import tasks
from oggm.cfg import SEC_IN_YEAR
from oggm.core.massbalance import MassBalanceModel
import numpy as np
import pandas as pd
import netCDF4
def single_flowline_glacier_directory(rgi_id, reset=False, prepro_border=80):
"""Prepar... | 2.3125 | 2 |
plotting/single_trials.py | PFMassiani/vibly | 5 | 28241 | import numpy as np
import matplotlib.pyplot as plt
# colors corresponding to initial flight, stance, second flight
colors = ['k', 'b', 'g']
### The attributes of sol are:
## sol.t : series of time-points at which the solution was calculated
## sol.y : simulation results, size 6 x times
## sol.t_events : list of t... | 3.25 | 3 |
ultracart/api/order_api.py | UltraCart/rest_api_v2_sdk_python | 1 | 28242 | <filename>ultracart/api/order_api.py
# coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2 # noqa: E501
OpenAPI spec version: 2.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: ... | 2.296875 | 2 |
project-vitas.py | bertmiller/nucypher-data-sharing-PoC | 1 | 28243 | <filename>project-vitas.py
import os
import sys
import json
import shutil
import ipfsapi
import base64
import datetime
import maya
from twisted.logger import globalLogPublisher
from umbral.keys import UmbralPublicKey
### NuCypher ###
from nucypher.characters.lawful import Alice, Bob, Ursula
from nucyphe... | 1.960938 | 2 |
SublimeText3_3176/Data/Packages/SublimeCodeIntel-master/libs/codeintel2/pythoncile1.py | xiexie1993/Tool_Sublime_Text3_for_Windows | 1 | 28244 | #!/usr/bin/env python
# Copyright (c) 2004-2006 ActiveState Software Inc.
#
# Contributors:
# <NAME> (<EMAIL>)
"""
pythoncile - a Code Intelligence Language Engine for the Python language
Module Usage:
from pythoncile import scan
mtime = os.stat("foo.py")[stat.ST_MTIME]
content = ope... | 2.5625 | 3 |
Perceptron/plot.py | hduliufan/work | 0 | 28245 | import numpy as np
class perceptron(object):
#eta learning rata
#n_iter times
def __init__(self,eta,n_iter):
self.eta=eta
self.n_iter=n_iter
def fit(self,x,y):
'''
x=ndarray(n_samples,n_features),training data
y=ndarray(n_samples),labels
returns
se... | 3.359375 | 3 |
src/pipelines/epidemiology/sd_humdata.py | chrismayemba/covid-19-open-data | 430 | 28246 | # 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 required by applicable law or agreed to in writing, ... | 2.59375 | 3 |
posthog/helpers/session_recording.py | lharress/posthog | 0 | 28247 | import base64
import dataclasses
import gzip
import json
from collections import defaultdict
from typing import DefaultDict, Dict, Generator, List, Optional
from sentry_sdk.api import capture_exception, capture_message
from posthog.models import utils
Event = Dict
SnapshotData = Dict
@dataclasses.dataclass
class P... | 2.171875 | 2 |
lexical-parse-float/etc/limits.py | sjurajpuchky/rust-lexical | 249 | 28248 | <gh_stars>100-1000
#!/usr/bin/env python3
"""
Generate the numeric limits for a given radix.
This is used for the fast-path algorithms, to calculate the
maximum number of digits or exponent bits that can be exactly
represented as a native value.
"""
import math
def is_pow2(value):
'''Calculate if a value is a p... | 3.953125 | 4 |
importer/management/commands/rebuild_variant_summary.py | brand-fabian/varfish-server | 14 | 28249 | """Django command for rebuilding cohort statistics after import."""
from django.core.management.base import BaseCommand
from django.db import transaction
from ...tasks import refresh_variants_smallvariantsummary
import variants.models as models
class Command(BaseCommand):
"""Implementation of rebuilding variant... | 2.09375 | 2 |
Python/9. Errors and Exceptions/exercise2.py | mukeshmithrakumar/HackerRankSolutions | 12 | 28250 | # Incorrect Regex "https://www.hackerrank.com/challenges/incorrect-regex/problem"
# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
for i in range(int(input())):
try:
re.compile(input())
print("True")
except ValueError:
print("False")
| 3.921875 | 4 |
Lectures/week_12/demo/api/urls.py | diable201/WEB-development | 1 | 28251 | <filename>Lectures/week_12/demo/api/urls.py
from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token
from api.views import category_list, category_detail, CategoryListAPIView, CategoryDetailAPIView, \
ProductListAPIView, ProductDetailAPIView
urlpatterns = [
# path('categories/', cat... | 2.25 | 2 |
igibson/examples/learning/demo_replaying_batch.py | StanfordVL/InteractiveGibsonEnv | 51 | 28252 | """
BEHAVIOR demo batch analysis script
"""
import argparse
import json
import logging
import os
from pathlib import Path
import pandas as pd
import igibson
from igibson.examples.learning.demo_replaying_example import replay_demo
def replay_demo_batch(
demo_dir,
demo_manifest,
out_dir,
get_callbacks... | 2.671875 | 3 |
editor/importme.py | Amazeryogo/surf-exel | 3 | 28253 | from Tkinter import *
from Tkinter import filedialog, simpledialog
from Tkinter import messagebox
from editor.settings import backgroundcolor as bc
from editor.settings import forgroundcolor as fc
from editor.settings import back as b
from editor.settings import fore as f
from editor.settings import size
from editor.se... | 1.671875 | 2 |
UDPMulticastClient.py | monteno-m/Challenge | 0 | 28254 | # Basic UDP Multicasting server built in python
import socket
import struct
def UDPReceiveMultiCast(group, port):
# Create UDP Socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('', port))
mreq = stru... | 2.640625 | 3 |
tests/test_scripts_basic.py | Holt59/bain-wizard-interpreter | 2 | 28255 | <filename>tests/test_scripts_basic.py
# -*- encoding: utf-8 -*-
"""
These tests are only here to check that running the test scripts do
not actually fails.
Important: If a script contains While loop that are cancelled by user,
it should not be tested here.
"""
from antlr4.error.Errors import ParseCancellationExcepti... | 2.46875 | 2 |
celerytest/tasks.py | dpfried/mocs | 8 | 28256 | from celery.task import task
from time import sleep
@task()
def add(x, y):
return x + y;
@task()
def status(delay):
status.update_state(state='PROGRESS', meta={'description': 'starting timer'})
sleep(delay)
status.update_state(state='PROGRESS', meta={'description': 'after first sleep'})
sleep(dela... | 2.578125 | 3 |
python-CSDN博客爬虫/CSDN_article/csdn/test.py | wangchuanli001/Project-experience | 12 | 28257 | <filename>python-CSDN博客爬虫/CSDN_article/csdn/test.py
import random
import MySQLdb
import requests
# ! -*- encoding:utf-8 -*-
import requests
# 要访问的目标页面
targetUrl = "https://blog.csdn.net/wang978252321/article/details/95489446"
# targetUrl = "http://proxy.abuyun.com/switch-ip"
# targetUrl = "http://proxy.abuyun.com/c... | 2.671875 | 3 |
to_offer/37_SerializeBinaryTrees.py | Run0812/algorithm | 0 | 28258 | <filename>to_offer/37_SerializeBinaryTrees.py<gh_stars>0
"""
面试题37:序列化二叉树
题目:请实现两个函数,分别用来序列化和反序列化二叉树
例:
树:
1
/ \
2 3
/ / \
4 5 6
序列化:
[1, 2, 4, $, $, $, 3, 5, $, $, 6, $, $]
"""
from datstru import TreeNode
from datstru import list_to_treenode
def serialize(root):
"""
:p... | 2.578125 | 3 |
setup.py | codecov/tornpsql | 0 | 28259 | <filename>setup.py
from setuptools import setup
setup(name='tornpsql',
version='2.1.5',
description="PostgreSQL handler for Tornado Web",
long_description="",
classifiers=["Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
... | 1.359375 | 1 |
workflow/scripts/mask-contigs.py | AKBrueggemann/snakemake-workflow-sars-cov2 | 0 | 28260 | <reponame>AKBrueggemann/snakemake-workflow-sars-cov2<filename>workflow/scripts/mask-contigs.py
'# Copyright ' + str(datetime.datetime.now().year) + ' <NAME>, <NAME>, <NAME>.'
'# Licensed under the GNU GPLv3 license (https://opensource.org/licenses/GPL-3.0)'
'# This file may not be copied, modified, or distributed'
... | 1.96875 | 2 |
prototyper/build/stages/wsgi_app.py | vitalik/django-prototyper | 114 | 28261 | <filename>prototyper/build/stages/wsgi_app.py
from ..base import BuildStage
from pathlib import Path
TPL = """\"\"\"
WSGI config for {0} project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deploymen... | 2.375 | 2 |
tests/test_http_api.py | b2wads/baas-transfer | 0 | 28262 | from aioresponses import aioresponses
from asynctest import TestCase
from asyncworker.testing import HttpClientContext
from baas.api import app
class TransferAPITest(TestCase):
async def test_health(self):
async with HttpClientContext(app) as client:
resp = await client.get("/health")
... | 2.390625 | 2 |
RLBotPack/BotimusPrime/source/maneuvers/air/fast_recovery.py | DaCoolOne/RLBotPack | 0 | 28263 | <gh_stars>0
from maneuvers.kit import *
from maneuvers.driving.arrive import Arrive
class FastRecovery(Maneuver):
def __init__(self, car: Car):
super().__init__(car)
self.turn = AerialTurn(car, look_at(vec3(0, 0, -1)))
self.landing = False
def step(self, dt):
self... | 2.671875 | 3 |
target/opsdev/WEB-INF/classes/shell/updateMobileManagerDataSource.py | ws02752587/opsdev | 0 | 28264 | import sys
import re
argvs = list(sys.argv)
result = ''
dataSourceName=argvs[1]
name=argvs[2]
if not dataSourceName or not name:
return
path="/mobile/app/upload/"+name+"/WEB-INF/classes/spring/applicationContext-ibatis.xml"
with open(path) as file:
result = file.read()
result = re.sub('<bean\\s+id\\s*=\\s*"da... | 2.390625 | 2 |
werewolf/models/__init__.py | LucienZhang/werewolf-back | 0 | 28265 | from .base import Base
from .user import User
from .game import Game
from .role import Role
| 1.179688 | 1 |
add-tags.py | tbma2014us/ops-tools | 2 | 28266 | <gh_stars>1-10
#!/usr/bin/env python
import logging
import sys
import argparse
import boto3
import botocore.exceptions
LOG_FORMAT = '%(asctime)s %(filename)s:%(lineno)s[%(process)d]: %(levelname)s: %(message)s'
class ArgsParser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs):
kwargs.setdef... | 2.640625 | 3 |
carCapture.py | ishmam367/Vehcle-Monitoring-System-BLPR- | 2 | 28267 | <gh_stars>1-10
import cv2
import time
#print(cv2.__version__)
cascade_src = 'cars.xml'
video_src = 'v3.avi'
start_time = time.time()
cap = cv2.VideoCapture(video_src)
#framerate = cap.get(5)
car_cascade = cv2.CascadeClassifier(cascade_src)
i=0
while True:
i=i+1
ret, img = cap.read()
if (type(img) == t... | 2.515625 | 3 |
src/m2_run_this_on_robot.py | myerscar1555/99-CapstoneProject-201920 | 0 | 28268 | """
Capstone Project. Code to run on the EV3 robot (NOT on a laptop).
Author: Your professors (for the framework)
and <NAME>.
Winter term, 2018-2019.
"""
import rosebot
import mqtt_remote_method_calls as com
import time
import shared_gui_delegate_on_robot as dingding
def main():
"""
This code, wh... | 3.21875 | 3 |
cvisionlib/camfeed.py | methusael13/cvision | 2 | 28269 | <reponame>methusael13/cvision
'''
Author: <NAME>
Module implementing parallel Camera I/O feed
'''
import cv2
from threading import Thread
class CameraFeedException(Exception):
def __init__(self, src, msg = None):
if msg is None:
msg = 'Unable to open camera devive: %d' % src
su... | 2.75 | 3 |
downloader.py | MCodez/Youtube-MP4-MP3-Downloader | 0 | 28270 | <reponame>MCodez/Youtube-MP4-MP3-Downloader
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 25 19:44:44 2018
@author: <NAME>
"""
from __future__ import unicode_literals
import youtube_dl
import urllib.parse
from bs4 import BeautifulSoup
def check_internet():
try:
urllib.request.urlopen('http... | 2.96875 | 3 |
newton.py | smrfeld/line_search_tutorial | 4 | 28271 | import numpy as np
from typing import Any, Tuple, Dict
import logging
class NotDescentDirection(Exception):
pass
class ZeroDescentProduct(Exception):
pass
class ZeroUpdate(Exception):
pass
class Newton:
def __init__(self,
obj_func : Any,
gradient_func : Any,
reg_inv_hessi... | 2.8125 | 3 |
chatmanage.py | NyaNyak/2021_OSS | 0 | 28272 | <gh_stars>0
import discord
import random
def filtering(message):
manage = "소환사님 🎀✨예쁜 말✨🎀을 사용해😡주세요~!😎😘"
return manage
def command():
embed = discord.Embed(title=f"명령어 모음", description="꿀벌봇은 현재 아래 기능들을 지원하고 있습니다!", color=0xf3bb76)
embed.set_thumbnail(url="https://mblogthumb-phinf.pstatic.net/MjAxOD... | 2.234375 | 2 |
Server/Python/src/dbs/dao/MySQL/File/MgrtList.py | vkuznet/DBS | 8 | 28273 | <filename>Server/Python/src/dbs/dao/MySQL/File/MgrtList.py
#!/usr/bin/env python
"""
This module provides File.MgrtList data access object.
"""
from dbs.dao.Oracle.File.MgrtList import MgrtList as OraFileMgrtList
class MgrtList(OraFileMgrtList):
pass
| 1.523438 | 2 |
test_intensity.py | gfzriesgos/deus | 1 | 28274 | #!/usr/bin/env python3
# Copyright © 2021 Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences, Potsdam, Germany
#
# 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
#
# https://www.ap... | 2.515625 | 3 |
verify_package_installs.py | lukassnoek/ICON2017_MVPA | 19 | 28275 | <filename>verify_package_installs.py
import warnings
import os
from importlib import import_module
packages = ['sklearn', 'nibabel', 'numpy',
'matplotlib', 'skbold', 'niwidgets', 'scipy']
warnings.filterwarnings("ignore")
for package in packages:
try:
import_module(package)
print('%s ... | 2.359375 | 2 |
python_practice/decorators.py | vishalvb/practice | 0 | 28276 | #decorators
def decorator(myfunc):
def wrapper(*args):
return myfunc(*args)
return wrapper
@decorator
def display():
print('display function')
@decorator
def info(name, age):
print('name is {} and age is {}'.format(name,age))
info('john', 23)
#hi = decorator(display)
#hi()
display() | 3.34375 | 3 |
tests/article_part_test.py | jhroot/content-store | 0 | 28277 | import pytest
from sqlalchemy.orm.exc import NoResultFound
from content_store.api.api import create_app
from content_store.api.config import TestingConfig
from content_store.api.models import ArticlePart
from content_store.api.repositories import ArticlePartRepository
from content_store.api.database import DB
@pytest... | 2.21875 | 2 |
Algorithms/032_TREE.py | ChaoticMarauder/Project_Rosalind | 0 | 28278 | def connected_tree(n, edge_list):
current_edges = len(edge_list)
edges_needed = (n-1) - current_edges
return edges_needed
def main():
with open('datasets/rosalind_tree.txt') as input_file:
input_data = input_file.read().strip().split('\n')
n = int(input_data.pop(0))
edge_l... | 3.671875 | 4 |
qiita_pet/handlers/api_proxy/processing.py | charles-cowart/qiita | 96 | 28279 | <reponame>charles-cowart/qiita<gh_stars>10-100
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -... | 2.078125 | 2 |
old_app/app.py | kelj0/GPGdotgetter | 0 | 28280 | <filename>old_app/app.py<gh_stars>0
from flask import Flask
app = Flask('savedots')
app.config['DATABASE_FILE'] = 'savedots_DB.sqlite'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///savedots_DB.sqlite'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.secret_key = "CHANGE_ME"
if __name__ == '__main__':
... | 1.882813 | 2 |
painindex_app/migrations/0002_auto_20140823_2046.py | xanv/painindex | 0 | 28281 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('painindex_app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='PainProfile',
fields... | 1.742188 | 2 |
nnet/trans_func.py | Bhumbra/Nnet | 1 | 28282 | # Transfer functions and derivatives
# Note _all_ transfer functions and derivatives _must_ accept keyword arguments
# and handle the output keyword argument out=z correctly.
# <NAME>
import numpy as np
import scipy.special
#-------------------------------------------------------------------------------
"""
def sigv... | 3.25 | 3 |
3GPP Meeting Helper/gui/tools.py | telekom/3gpp-meeting-tools | 0 | 28283 | <reponame>telekom/3gpp-meeting-tools<gh_stars>0
import application
import tkinter
import gui.main
import gui.tdocs_table
import os
import os.path
import server
import traceback
import parsing.html as html_parser
import parsing.excel as excel_parser
import parsing.outlook
import parsing.word as word_parser
import thread... | 2.453125 | 2 |
swift3/cfg.py | KoreaCloudObjectStorage/swift3 | 0 | 28284 | # Copyright (c) 2014 OpenStack Foundation.
#
# 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... | 2.234375 | 2 |
console/widgets/pane.py | dustinlacewell/console | 11 | 28285 | import urwid
from console.app import app
from console.widgets.help import HelpDialog
class Pane(urwid.WidgetPlaceholder):
"""
A widget which allows for easy display of dialogs.
"""
def __init__(self, widget=urwid.SolidFill(' ')):
urwid.WidgetPlaceholder.__init__(self, widget)
self.wi... | 3.140625 | 3 |
kvmagent/kvmagent/plugins/baremetal_v2_gateway_agent.py | zstackio/zstack-utility | 55 | 28286 | <reponame>zstackio/zstack-utility
import json
import os
import shutil
from jinja2 import Template
from zstacklib.utils import http
from zstacklib.utils import jsonobject
from zstacklib.utils import linux
from zstacklib.utils import linux_v2
from zstacklib.utils import iptables
from zstacklib.utils import lock
from zst... | 1.351563 | 1 |
ajaximage/__init__.py | kitsunefet/django-ajax-image-upload | 11 | 28287 | <gh_stars>10-100
__version__ = '0.9.4'
default_app_config = 'ajaximage.apps.AjaxImageConfig'
| 1.101563 | 1 |
qiskit_experiments/calibration_management/calibrations.py | blakejohnson/qiskit-experiments | 0 | 28288 | <gh_stars>0
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or d... | 2.015625 | 2 |
simple_open_graph/templatetags/simple_open_graph.py | haylmfao/django-simple-open-graph | 0 | 28289 | <filename>simple_open_graph/templatetags/simple_open_graph.py
from django import template
from django.contrib.sites.models import Site
from django.conf import settings
from ..utils import string_to_dict, roundrobin
register = template.Library()
@register.tag
def opengraph_meta(parser, token):
try:
tag_na... | 2.296875 | 2 |
src/articles/migrations/0001_initial.py | yaongli/spadger | 0 | 28290 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-17 13:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | 1.632813 | 2 |
config/scripts/dados-pygen/models.py | uhndev/hateoas-server | 0 | 28291 | <gh_stars>0
import random
import config
from faker import Factory
fake = Factory.create()
class User:
def __init__(self):
self.username = fake.user_name()
self.email = fake.company_email()
self.firstName = fake.first_name()
self.lastName = fake.last_name()
self.dateOfBirth = fake.iso8601()
s... | 2.765625 | 3 |
src/test.py | chatdip98/Acoustic-Scene-Classification | 0 | 28292 | #------testing the trained model and ensemble weights on the test data to get the final accuracy
#importing required libraries and modules
import os
import sys
import cv2
import numpy as np
from preprocess import Preprocess
from data_split import Load
from conv_net import CNN
from ensemble import Ensemble
... | 3.125 | 3 |
sdk/python/pulumi_google_native/clouddeploy/v1/rollout.py | AaronFriel/pulumi-google-native | 44 | 28293 | <reponame>AaronFriel/pulumi-google-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Unio... | 1.648438 | 2 |
batuta/base.py | makecodes/batuta | 0 | 28294 | from dynaconf import FlaskDynaconf
from flask import Flask
def create_app(**config):
app = Flask(__name__)
FlaskDynaconf(app) # config managed by Dynaconf
app.config.load_extensions('EXTENSIONS') # Load extensions from settings.toml
app.config.update(config) # Override with passed config
return... | 2.296875 | 2 |
classification/model/model.py | hirune924/CVpipeline | 0 | 28295 | <reponame>hirune924/CVpipeline<filename>classification/model/model.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import torchvision.models as models
import torch.nn as nn
def get_model_from_name(model_name=None, image_size=None, num_classes=None, pretrained=True):
if model_name == 'resnet18':
... | 2.5625 | 3 |
dragonBall.py | falconcode16/pythonprogramming | 2 | 28296 | <filename>dragonBall.py<gh_stars>1-10
from collections import Counter
if __name__ == '__main__':
tc = int(input())
while tc > 0:
x = int(input())
balls = list(map(int, input().split()))
count = Counter(balls)
balls = list(filter((x).__ne__, balls))
if balls[0] == count[b... | 3.203125 | 3 |
packages/terminal_colors_old/gen_colors.py | kboone/dotfiles | 0 | 28297 | <reponame>kboone/dotfiles<gh_stars>0
from skimage import color
import numpy as np
colors = [
("base03", (10., +00., -05.)),
("base02", (15., +00., -05.)),
("base01", (45., -01., -05.)),
("base00", (50., -01., -05.)),
("base0", (60., -01., -02.)),
("base1", (65., -01., -02.)),
... | 1.992188 | 2 |
python/smurff/test/test_predict_sideinfo.py | msteijaert/smurff | 0 | 28298 | <reponame>msteijaert/smurff
import unittest
import numpy as np
import pandas as pd
import scipy.sparse
import smurff
verbose = 0
class TestPredictSession(unittest.TestCase):
# Python 2.7 @unittest.skip fix
__name__ = "TestPredictSession"
def run_train_session(self):
Ydense = np.random.normal(siz... | 2.421875 | 2 |
gewittergefahr/dissertation/plot_gridrad_domains.py | dopplerchase/GewitterGefahr | 26 | 28299 | """Plots GridRad domains.
Specifically, plots number of convective days with GridRad data at each grid
point.
"""
import os.path
import argparse
import numpy
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot
from mpl_toolkits.basemap import Basemap
from gewittergefahr.gg_io import gridrad_io
from ... | 2.734375 | 3 |