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 |
|---|---|---|---|---|---|---|
src/flask_easy/auth.py | Josephmaclean/flask-easy | 1 | 23600 | <filename>src/flask_easy/auth.py
"""
auth.py
Author: <NAME>
"""
import os
import inspect
from functools import wraps
import jwt
from flask import request
from jwt.exceptions import ExpiredSignatureError, InvalidTokenError, PyJWTError
from .exc import Unauthorized, ExpiredTokenException, OperationError
def auth_requ... | 2.90625 | 3 |
src/prefect/engine/result_handlers/secret_result_handler.py | trapped/prefect | 1 | 23601 | <filename>src/prefect/engine/result_handlers/secret_result_handler.py
import json
from typing import Any
import prefect
from prefect.engine.result_handlers import ResultHandler
class SecretResultHandler(ResultHandler):
"""
Hook for storing and retrieving sensitive task results from a Secret store. Only inten... | 3.015625 | 3 |
hnn_core/tests/test_dipole.py | mkhalil8/hnn-core | 0 | 23602 | import os.path as op
from urllib.request import urlretrieve
import matplotlib
import numpy as np
from numpy.testing import assert_allclose
import pytest
import hnn_core
from hnn_core import read_params, read_dipole, average_dipoles
from hnn_core import Network, jones_2009_model
from hnn_core.viz import plot_dipole
fr... | 2.046875 | 2 |
setup.py | creeston/chinese | 15 | 23603 | <reponame>creeston/chinese
from setuptools import setup, find_packages
with open('docs/README-rst') as f:
desc = f.read()
setup(
name='chinese',
version='0.2.1',
license='MIT',
url='https://github.com/morinokami/chinese',
keywords=['Chinese', 'text analysis'],
classifiers=[
'Develo... | 1.601563 | 2 |
glacis_core/api/get_keys.py | ImperiumSec/glacis_core | 0 | 23604 | from ..models import EntityOnServer, AccessToken, Organisation, Server, ServerUser, Key, KeyFetchEvent, AuditNote, AuditEvent, LoginAttempt
from django.template import Context, Template
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from uuid import uuid4
from datetime import... | 2 | 2 |
core/translator.py | bfu4/mdis | 13 | 23605 | from typing import List
from parser import parse_bytes, split_bytes_from_lines, get_bytes, parse_instruction_set, wrap_parsed_set
from reader import dump_file_hex_with_locs
class Translator:
"""
Class handling file translations from *.mpy to hex dumps and opcodes
"""
def __init__(self, file: str):
... | 3.28125 | 3 |
easyp2p/p2p_signals.py | Ceystyle/easyp2p | 4 | 23606 | <filename>easyp2p/p2p_signals.py
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2020 <NAME>
"""Module implementing Signals for communicating with the GUI."""
from functools import wraps
import logging
from PyQt5.QtCore import QObject, pyqtSignal
class Signals(QObject):
"""Class for signal communication between... | 2.734375 | 3 |
extra_tests/ctypes_tests/test_unions.py | nanjekyejoannah/pypy | 333 | 23607 | import sys
from ctypes import *
def test_getattr():
class Stuff(Union):
_fields_ = [('x', c_char), ('y', c_int)]
stuff = Stuff()
stuff.y = ord('x') | (ord('z') << 24)
if sys.byteorder == 'little':
assert stuff.x == b'x'
else:
assert stuff.x == b'z'
def test_union_of_struct... | 2.765625 | 3 |
nssrc/com/citrix/netscaler/nitro/resource/config/snmp/snmpmib.py | guardicore/nitro-python | 0 | 23608 | <filename>nssrc/com/citrix/netscaler/nitro/resource/config/snmp/snmpmib.py
#
# Copyright (c) 2021 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... | 1.828125 | 2 |
lambda-archive/lambda-functions/codebreaker-update-testcaseCount/lambda_function.py | singaporezoo/codebreaker-official | 11 | 23609 | import json
import boto3 # Amazon S3 client library
s3 = boto3.resource('s3')
dynamodb = boto3.resource('dynamodb')
problems_table = dynamodb.Table('codebreaker-problems')
bucket = s3.Bucket('codebreaker-testdata')
def lambda_handler(event, context):
problemName = event['problemName']
testcaseCount = 0
fo... | 2.078125 | 2 |
bin/varipack.py | angrydill/ItsyBitser | 0 | 23610 | <reponame>angrydill/ItsyBitser<gh_stars>0
#!/usr/bin/env python3
""" Packs/unpacks Hextream content to/from the Varipacker format """
import sys
import argparse
from itsybitser import hextream, varipacker
def main():
""" Program entry point """
parser = argparse.ArgumentParser(
description="Packs/unp... | 3.09375 | 3 |
reobject/models/model.py | agusmakmun/reobject | 92 | 23611 | <gh_stars>10-100
import attr
from reobject.models.manager import ManagerDescriptor, RelatedManagerDescriptor
from reobject.models.store import Store, ModelStoreMapping
class ModelBase(type):
"""
Metaclass for all models, used to attach the objects class attribute
to the model instance at runtime.
"""... | 2.359375 | 2 |
label.py | winstonwzhang/osumapper | 0 | 23612 | <gh_stars>0
import os
import re
import sys
import pdb
import numpy as np
from math import log, e
from scipy.signal import find_peaks
import word
from utils import *
# hit object subword integer representations from word.py
h_int = word.obj_str2int[word.HITCIRCLE]
e_int = word.obj_str2int[word.EMPTY]
sb_int = word.obj... | 2.25 | 2 |
bbp/tests/AcceptTests.py | kevinmilner/bbp | 0 | 23613 | #!/usr/bin/env python
"""
Southern California Earthquake Center Broadband Platform
Copyright 2010-2017 Southern California Earthquake Center
These are acceptance tests for the broadband platforms
$Id: AcceptTests.py 1795 2017-02-09 16:23:34Z fsilva $
"""
from __future__ import division, print_function
# Import Python... | 2.53125 | 3 |
tutorials/03-advanced/image_captioning/model.py | xuwangyin/pytorch-tutorial | 11 | 23614 | import torch
import torch.nn as nn
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence as pack
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.autograd import Variable
class EncoderCNN(nn.Module):
def __init__(self, embed_size):
"""Load the pretr... | 2.609375 | 3 |
.ipynb_checkpoints/main2-checkpoint.py | jcus/python-challenge | 0 | 23615 | <reponame>jcus/python-challenge
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "001887f2",
"metadata": {},
"outputs": [],
"source": [
"# import os modules to create path across operating system to load csv file\n",
"import os\n",
"# module for reading csv files\n",
... | 2.421875 | 2 |
Algorithms/Problems/MaximumSubarray/tests/maximum_substring_naive_test.py | Nalhin/AlgorithmsAndDataStructures | 1 | 23616 | <reponame>Nalhin/AlgorithmsAndDataStructures
from Algorithms.Problems.MaximumSubarray.maximum_substring_naive import (
maximum_subarray_naive,
)
class TestMaximumSubarrayNaive:
def test_returns_maximum_subarray(self):
data = [1, -2, 3, 10, -5, 14]
expected = [3, 10, -5, 14]
result = m... | 3.078125 | 3 |
helios/workflows/__init__.py | thiagosfs/helios-server | 525 | 23617 | """
Helios Election Workflows
"""
from helios.datatypes import LDObjectContainer
class WorkflowObject(LDObjectContainer):
pass
| 1.007813 | 1 |
tests/test_searcher.py | dbvirus/searcher | 0 | 23618 | """
Unit tests for the searcher module. Those tests mock the Entrez class
and do not make any sort of HTTP request.
"""
# pylint: disable=redefined-outer-name
import io
from pathlib import Path
from Bio import Entrez
from dbvirus_searcher import Searcher
def test_searcher_initialization(searcher):
"""
Tests a... | 2.859375 | 3 |
isso/tests/test_html.py | Nildeala/isso | 1 | 23619 | <reponame>Nildeala/isso
try:
import unittest2 as unittest
except ImportError:
import unittest
from isso.core import Config
from isso.utils import html
class TestHTML(unittest.TestCase):
def test_markdown(self):
convert = html.Markdown(extensions=())
examples = [
("*Ohai!*",... | 2.828125 | 3 |
tests/data_elements/test_other_double.py | GalBenZvi/dicom_parser | 11 | 23620 | """
Definition of the :class:`OtherDoubleTestCase` class.
"""
from dicom_parser.data_elements.other_double import OtherDouble
from tests.test_data_element import DataElementTestCase
class OtherDoubleTestCase(DataElementTestCase):
"""
Tests for the
:class:`~dicom_parser.data_elements.other_double.OtherDoub... | 1.734375 | 2 |
acme_compact.py | felixfontein/acme-compact | 5 | 23621 | #!/usr/bin/env python
"""Command line interface for the compact ACME library."""
import acme_lib
import argparse
import sys
import textwrap
def _gen_account_key(account_key, key_length, algorithm):
key = acme_lib.create_key(key_length=key_length, algorithm=algorithm)
acme_lib.write_file(account_key, key)
d... | 2.5 | 2 |
cdk/consoleme_ecs_service/nested_stacks/vpc_stack.py | avishayil/consoleme-ecs-service | 2 | 23622 | """
VPC stack for running ConsoleMe on ECS
"""
import urllib.request
from aws_cdk import (
aws_ec2 as ec2,
core as cdk
)
class VPCStack(cdk.NestedStack):
"""
VPC stack for running ConsoleMe on ECS
"""
def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
super().__ini... | 2.421875 | 2 |
mnt/us/kapps/apps/gallery/gallery.py | PhilippMundhenk/kapps | 1 | 23623 | <reponame>PhilippMundhenk/kapps
from core.kapp import Kapp
from core.httpResponse import HTTPResponse
from core.Kcommand import Kcommand
import uuid
import os
class GetImage(Kcommand):
getImageHash = str(uuid.uuid4())
def __init__(self):
super(GetImage, self).__init__(
"GetImage", self.ge... | 2.5 | 2 |
answers/easy/single-number.py | kigawas/lintcode-python | 1 | 23624 | <gh_stars>1-10
class Solution:
"""
@param A : an integer array
@return : a integer
"""
def singleNumber(self, A):
# write your code here
return reduce(lambda x, y: x ^ y, A) if A != [] else 0
| 2.8125 | 3 |
adding/adding_task.py | tk-rusch/coRNN | 24 | 23625 | from torch import nn, optim
import torch
import model
import torch.nn.utils
import utils
import argparse
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
parser = argparse.ArgumentParser(description='training parameters')
parser.add_argument('--n_hid', type=int, default=128,
... | 2.34375 | 2 |
notebooks/KJIO/kapi_io.py | Eclasik/kinetica-jupyterlab | 2 | 23626 | <reponame>Eclasik/kinetica-jupyterlab
# File: kapi_io.py
# Purpose: I/O of between dataframes and Kinetica with native API.
# Author: <NAME>
# Date: 07/20/2018
###############################################################################
import numpy as np
import pandas as pd
import gpudb
import sys
KDBC = gpudb.GP... | 2.375 | 2 |
batch/batch/driver/k8s_cache.py | MariusDanner/hail | 2 | 23627 | import time
import asyncio
import sortedcontainers
from hailtop.utils import retry_transient_errors
class K8sCache:
def __init__(self, client, refresh_time, max_size=100):
self.client = client
self.refresh_time = refresh_time
self.max_size = max_size
self.secrets = {}
sel... | 2.171875 | 2 |
pluploader/upm/exceptions.py | craftamap/pluploader | 12 | 23628 | class UploadFailedException(Exception):
pass
| 1.125 | 1 |
tools/nntool/interpreter/commands/imageformat.py | gemenerik/gap_sdk | 0 | 23629 | # Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... | 2.046875 | 2 |
svae/__init__.py | APodolskiy/SentenceVAE | 0 | 23630 | <reponame>APodolskiy/SentenceVAE
import torch.nn as nn
RNN_TYPES = {
'lstm': nn.LSTM,
'gru': nn.GRU
}
| 2.078125 | 2 |
extract_embeddings.py | Artem531/opencv-face-recognition-with-YOLOv3 | 0 | 23631 | # USAGE
# python extract_embeddings.py --dataset dataset --embeddings output/embeddings.pickle \
# --detector face_detection_model --embedding-model openface_nn4.small2.v1.t7
# import the necessary packages
from imutils.face_utils import FaceAligner
from imutils import paths
import numpy as np
import argparse
import i... | 2.40625 | 2 |
alf/algorithms/diayn_algorithm.py | runjerry/alf | 1 | 23632 | <filename>alf/algorithms/diayn_algorithm.py
# Copyright (c) 2020 Horizon Robotics. All Rights Reserved.
#
# 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... | 2.234375 | 2 |
src/genie/libs/parser/linux/route.py | balmasea/genieparser | 204 | 23633 | """route.py
Linux parsers for the following commands:
* route
"""
# python
import re
# metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, Any, Optional
from netaddr import IPAddress, IPNetwork
# =======================================================
# Sch... | 2.734375 | 3 |
chapter-7/chassis/demo.py | wallacei/microservices-in-action-copy | 115 | 23634 | import json
import datetime
import requests
from nameko.web.handlers import http
from nameko.timer import timer
from statsd import StatsClient
from circuitbreaker import circuit
class DemoChassisService:
name = "demo_chassis_service"
statsd = StatsClient('localhost', 8125, prefix='simplebank-demo')
@htt... | 2.203125 | 2 |
src/autodoc/python/rst/base/block_quote.py | LudditeLabs/autodoc-tool | 0 | 23635 | # Copyright 2018 Luddite Labs Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 1.921875 | 2 |
userdocker/subcommands/run.py | jsteffen/userdocker | 0 | 23636 | <gh_stars>0
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import re
from .. import __version__
from ..config import ALLOWED_IMAGE_REGEXPS
from ..config import ALLOWED_PORT_MAPPINGS
from ..config import CAPS_ADD
from ..config import CAPS_DROP
from ..config import ENV_VARS
from ..config import ENV_VA... | 1.859375 | 2 |
URI 1017.py | Azefalo/Cluble-de-Programacao-UTFPR | 1 | 23637 | <filename>URI 1017.py
# https://www.beecrowd.com.br/judge/en/problems/view/1017
car_efficiency = 12 # Km/L
time = int(input())
average_speed = int(input())
liters = (time * average_speed) / car_efficiency
print(f"{liters:.3f}") | 3.171875 | 3 |
src/cpp/convert.py | shindavid/splendor | 1 | 23638 | filename = '../py/cards.py'
f = open(filename)
color_map = {
'W' : 'eWhite',
'U' : 'eBlue',
'G' : 'eGreen',
'R' : 'eRed',
'B' : 'eBlack',
'J' : 'eGold',
}
color_index_map = {
'W' : 0,
'U' : 1,
'G' : 2,
'R' : 3,
'B' : 4
}
def convert(cost_str):
cost_array = [0,0,0... | 2.921875 | 3 |
code_examples/projections/cyl.py | ezcitron/BasemapTutorial | 99 | 23639 | from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap(projection='cyl')
map.drawmapboundary(fill_color='aqua')
map.fillcontinents(color='coral',lake_color='aqua')
map.drawcoastlines()
plt.show() | 2.265625 | 2 |
applications/ShapeOptimizationApplication/python_scripts/analyzer_internal.py | AndreaVoltan/MyKratos7.0 | 2 | 23640 | <reponame>AndreaVoltan/MyKratos7.0<gh_stars>1-10
# ==============================================================================
# KratosShapeOptimizationApplication
#
# License: BSD License
# license: ShapeOptimizationApplication/license.txt
#
# Main authors: <NAME>, https://gith... | 1.851563 | 2 |
tests/frontend/detector/test_fast.py | swershrimpy/gtsfm | 122 | 23641 | <reponame>swershrimpy/gtsfm<gh_stars>100-1000
"""Tests for frontend's FAST detector class.
Authors: <NAME>
"""
import unittest
import tests.frontend.detector.test_detector_base as test_detector_base
from gtsfm.frontend.detector.fast import Fast
class TestFast(test_detector_base.TestDetectorBase):
"""Test class ... | 1.921875 | 2 |
problem/13_Roman_to_Integer.py | YoungYoung619/leetcode | 0 | 23642 | <filename>problem/13_Roman_to_Integer.py
"""
Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University.
All rights reserved.
Description :
Author:<NAME>
"""
"""
13. Roman to Integer
Easy
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I... | 4.03125 | 4 |
tests/test_cli.py | KoichiYasuoka/pynlpir | 537 | 23643 | """Unit tests for pynlpir's cli.py file."""
import os
import shutil
import stat
import unittest
try:
from urllib.error import URLError
from urllib.request import urlopen
except ImportError:
from urllib2 import URLError, urlopen
from click.testing import CliRunner
from pynlpir import cli
TEST_DIR = os.pat... | 2.8125 | 3 |
src/old/parsemod/cft_expr.py | TeaCondemns/cofty | 1 | 23644 | <reponame>TeaCondemns/cofty
from cft_namehandler import NameHandler, get_value_returned_type, get_local_name, get_abs_composed_name
from parsemod.cft_name import is_name, is_kw, compose_name
from parsemod.cft_syntaxtree_values import str_type
from parsemod.cft_others import extract_tokens
from cft_errors_handler import... | 2 | 2 |
src/ychaos/cli/exceptions/__init__.py | vanderh0ff/ychaos | 8 | 23645 | <filename>src/ychaos/cli/exceptions/__init__.py
# Copyright 2021, Yahoo
# Licensed under the terms of the Apache 2.0 license. See the LICENSE file in the project root for terms
from abc import abstractmethod
from typing import Any, Dict
class YChaosCLIError(Exception):
exitcode = 1
def __init__(self, app... | 2.71875 | 3 |
ibmsecurity/isam/base/fips.py | zone-zero/ibmsecurity | 46 | 23646 | import logging
import ibmsecurity.utilities.tools
import time
logger = logging.getLogger(__name__)
requires_model = "Appliance"
def get(isamAppliance, check_mode=False, force=False):
"""
Retrieving the current FIPS Mode configuration
"""
return isamAppliance.invoke_get("Retrieving the current FIPS M... | 2.4375 | 2 |
user_details/give_default.py | Shreyanshsachan/College-Predictor | 0 | 23647 | preference_list_of_user=[]
def give(def_list):
Def=def_list
global preference_list_of_user
preference_list_of_user=Def
return Def
def give_to_model():
return preference_list_of_user | 1.921875 | 2 |
face_recognition/project/type_hints.py | dgr113/face-recognition | 0 | 23648 | <reponame>dgr113/face-recognition
# coding: utf-8
import numpy as np
import keras.utils
from pathlib import Path
from typing import Tuple, Sequence, Union, Hashable, Iterable, Mapping, Any
### COMMON TYPES
UNIVERSAL_PATH_TYPE = Union[Path, str]
UNIVERSAL_SOURCE_TYPE = Union[UNIVERSAL_PATH_TYPE, Mapping]
CHUNKED_DATA... | 2.484375 | 2 |
modules/augmentation.py | AdamMiltonBarker/hias-all-oneapi-classifier | 1 | 23649 | #!/usr/bin/env python
""" HIAS AI Model Data Augmentation Class.
Provides data augmentation methods.
MIT License
Copyright (c) 2021 Asociación de Investigacion en Inteligencia Artificial
Para la Leucemia <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associa... | 2.421875 | 2 |
pytglib/api/types/rich_text_phone_number.py | iTeam-co/pytglib | 6 | 23650 | <filename>pytglib/api/types/rich_text_phone_number.py
from ..utils import Object
class RichTextPhoneNumber(Object):
"""
A rich text phone number
Attributes:
ID (:obj:`str`): ``RichTextPhoneNumber``
Args:
text (:class:`telegram.api.types.RichText`):
Text
phone_... | 2.71875 | 3 |
cne/__init__.py | BartWojtowicz/cne | 0 | 23651 | <reponame>BartWojtowicz/cne
from .cne import CNE
__version__ = "0.0.dev"
| 0.882813 | 1 |
tests/core/scenario_finder/file_filters/test_file_filter.py | nikitanovosibirsk/vedro | 2 | 23652 | from pytest import raises
from vedro._core._scenario_finder._file_filters import FileFilter
def test_file_filter():
with raises(Exception) as exc_info:
FileFilter()
assert exc_info.type is TypeError
assert "Can't instantiate abstract class FileFilter" in str(exc_info.value)
| 1.929688 | 2 |
concept_disc/pubmed_dump.py | nmonath/concept_discovery | 3 | 23653 | <reponame>nmonath/concept_discovery
"""
Parse PubMed Dump
Ref:
https://www.nlm.nih.gov/databases/download/pubmed_medline.html
https://www.nlm.nih.gov/bsd/licensee/elements_alphabetical.html
https://www.nlm.nih.gov/bsd/licensee/elements_descriptions.html#medlinecitation
"""
from collections import defaultdict
from co... | 1.703125 | 2 |
Consumer_test.py | image-store-org/image-store-py-web-api-consumer-test | 0 | 23654 | <filename>Consumer_test.py
import sys
sys.path.append('dependencies/image-store-py-web-api-consumer')
from Consumer import Consumer
class Consumer_test:
def __init__(self):
self.c = Consumer()
def get(self):
print('\x1b[6;30;42m' + 'GET' + '\x1b[0m')
print(self.c.get())
... | 2.5 | 2 |
Algorithms/MostCommonWord/mostCommonWord.py | riddhi-27/HacktoberFest2020-Contributions | 0 | 23655 | """Returns words from the given paragraph which has been repeated most,
incase of more than one words, latest most common word is returned. """
import string
def mostCommonWord(paragraph: str) -> str:
# translate function maps every punctuation in given string to white space
words = paragraph.translate(st... | 4.15625 | 4 |
app/views.py | PaulMurrayCbr/GameNight | 0 | 23656 | from app import app, db
from flask import render_template, flash, redirect, get_flashed_messages
import forms
import models
import Character
from flask.globals import request
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
def menugear() :
return {
'pcs': models.Character.query.all()
}
@a... | 2.171875 | 2 |
dingomata/config/__init__.py | tigershadowclaw/discord-dingomata | 0 | 23657 | from .bot import GuildConfig, ServiceConfig, get_logging_config, service_config
__all__ = [
"ServiceConfig",
"GuildConfig",
"get_logging_config",
"service_config",
]
| 1.25 | 1 |
create_tacacs.py | cromulon-actual/ise_automation | 0 | 23658 | <reponame>cromulon-actual/ise_automation
from ciscoisesdk import IdentityServicesEngineAPI
from ciscoisesdk.exceptions import ApiError
from dotenv import load_dotenv
import os
from pprint import pprint as ppr
load_dotenv()
admin = os.getenv("ISE_ADMIN")
pw = os.getenv("ISE_PW")
base_url = os.getenv("ISE_URL")
api = I... | 1.976563 | 2 |
8_plot_data_perstation.py | sdat2/Yellowstone2 | 0 | 23659 | # Program 8_plot_data_perstation.py written by <NAME> (<EMAIL>)
file_name= '8_plot_data_perstation.py'
# Uses receiver functions computed to produce a nice graph for every directory in DATARF
import obspy
from obspy import read
from obspy.core import Stream
from obspy.core import trace
import matplotlib.pyplot as plt
... | 2.25 | 2 |
archon/__init__.py | HyechurnJang/archon | 1 | 23660 | # -*- coding: utf-8 -*-
################################################################################
# _____ _ _____ _ #
# / ____(_) / ____| | | #
# | | _ ___ ___ ___ | (___ _ _ ___... | 1.984375 | 2 |
src_Python/EtabsAPIaface0/a01comtypes/Excel03c.py | fjmucho/APIdeEtabsYPython | 0 | 23661 | import sys
import comtypes
from comtypes.client import CreateObject
try:
# Connecting | coneccion
xl = CreateObject("Excel.Application")
except (OSError, comtypes.COMError):
print("No tiene instalada el programa(Excel).")
sys.exit(-1)
xl.Visible = True
print (xl) | 2.265625 | 2 |
home/tests/add-remove sector.py | caggri/FOFviz | 2 | 23662 | from selenium import webdriver
import time
chromedriver = "C:/Users/deniz/chromedriver/chromedriver"
driver = webdriver.Chrome(chromedriver)
driver.get('http://127.0.0.1:8000/')
dashboard = '//*[@id="accordionSidebar"]/li[1]/a'
sectors_1 = '//*[@id="sectors"]'
sectors_1_element = '//*[@id="sectors"]/option[4]'
add_s... | 2.875 | 3 |
netensorflow/api_samples/ann_creation_and_usage.py | psigelo/NeTensorflow | 0 | 23663 | import tensorflow as tf
from netensorflow.ann.ANN import ANN
from netensorflow.ann.macro_layer.MacroLayer import MacroLayer
from netensorflow.ann.macro_layer.layer_structure.InputLayerStructure import InputLayerStructure
from netensorflow.ann.macro_layer.layer_structure.LayerStructure import LayerStructure, LayerType
... | 3 | 3 |
auth-backend.py | alexanderbittner/spotify-tracks | 0 | 23664 | <filename>auth-backend.py
import json
from flask import Flask, request, redirect, g, render_template
import requests
from urllib.parse import quote
# Adapted from https://github.com/drshrey/spotify-flask-auth-example
# Authentication Steps, paramaters, and responses are defined at https://developer.spotify.com/web-api... | 2.890625 | 3 |
Regression/utils_testing.py | saucec0de/sifu | 5 | 23665 | import yaml
import os
### Sample Contents of config.yaml:
# 0002_info_leakage:
# category: Sifu C/C++
# points: 100
# description: Leave no trace
# vulnerability: CWE-14 * Information Leakage
# directory: Challenges/C_CPP/0002_info_leakage
# send_dir: true
# file: func_000... | 2.453125 | 2 |
python/arachne/runtime/rpc/logger.py | fixstars/arachne | 3 | 23666 | import logging
class Logger(object):
stream_handler = logging.StreamHandler()
formatter = logging.Formatter("[%(levelname)s %(pathname)s:%(lineno)d] %(message)s")
stream_handler.setFormatter(formatter)
stream_handler.setLevel(logging.INFO)
my_logger = logging.Logger("arachne.runtime.rpc")
my_... | 2.8125 | 3 |
examples/pykey60/code-1.py | lesley-byte/pykey | 0 | 23667 | #pylint: disable = line-too-long
import os
import time
import board
import neopixel
import keypad
import usb_hid
import pwmio
import rainbowio
from adafruit_hid.keyboard import Keyboard
from pykey.keycode import KB_Keycode as KC
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
# Hardware definition: GPIO... | 2.671875 | 3 |
tags.py | Manugs51/TFM_Metaforas | 0 | 23668 | <gh_stars>0
UNIVERSAL_POS_TAGS = {
'VERB': 'verbo',
'NOUN': 'nombre',
'PRON': 'pronombre',
'ADJ' : 'adjetivo',
'ADV' : 'adverbio',
'ADP' : 'aposición',
'CONJ': 'conjunción',
'DET' : 'determinante',
'NUM' : 'numeral',
'PRT' : 'partícula gramatical',
'X' : 'desconocido',
... | 1.53125 | 2 |
pyramid_oereb/contrib/data_sources/standard/sources/availability.py | pyramidoereb/pyramid_oereb | 2 | 23669 |
from pyramid_oereb.core.sources import BaseDatabaseSource
from pyramid_oereb.core.sources.availability import AvailabilityBaseSource
class DatabaseSource(BaseDatabaseSource, AvailabilityBaseSource):
def read(self):
"""
The read method to access the standard database structure. It uses SQL-Alchem... | 2.515625 | 3 |
tests/fixtures/specification.py | FlyingBird95/openapi_generator | 3 | 23670 | from pytest_factoryboy import register
from tests.factories.specification import (
CallbackFactory,
ComponentsFactory,
ContactFactory,
DiscriminatorFactory,
EncodingFactory,
ExampleFactory,
ExternalDocumentationFactory,
HeaderFactory,
InfoFactory,
LicenseFactory,
LinkFactory... | 1.625 | 2 |
app.py | samstruthers35/sqlalchemy-challenge | 0 | 23671 | <filename>app.py<gh_stars>0
import datetime as dt
import numpy as np
import pandas as pd
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask import Flask, jsonify, render_template
engine = create_engine('sqlite:///ha... | 3.0625 | 3 |
WebSocket_Chat_Room/chat_room_v001/handlers/login.py | MMingLeung/Python_Study | 3 | 23672 | <gh_stars>1-10
#!/usr/bin/env python
#! -*- coding: utf-8 -*-
'''
Handler for login
'''
import tornado.web
from lib.db_controller import DBController
from lib.CUSTOMIZED_SESSION.my_session import SessionFactory
class LoginHandler(tornado.web.RequestHandler):
def initialize(self):
# 钩子函数 首先执行
class... | 2.515625 | 3 |
hackerrank/python/introduction/function.py | wingkwong/competitive-programming | 18 | 23673 | <reponame>wingkwong/competitive-programming
def is_leap(year):
leap = False
# Write your logic here
# The year can be evenly divided by 4, is a leap year, unless:
# The year can be evenly divided by 100, it is NOT a leap year, unless:
# The year is also evenly divisible by 400. Then it is a lea... | 4.03125 | 4 |
projectenv/main/forms.py | rzsaglam/project-env | 0 | 23674 | <filename>projectenv/main/forms.py
from django import forms
from django.contrib.auth import models
from django.db.models.base import Model
from django.forms import ModelForm, fields
from .models import Paint
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserC... | 2.46875 | 2 |
njdate/hebdfind.py | schorrm/njdate | 4 | 23675 | <reponame>schorrm/njdate
# Takes two years, and runs an aggressive search for dates in between those two years (inclusive).
import njdate.gematria as gematria
import njdate.ej_generic as ej_generic
import string
specpunc = string.punctuation.replace('"','').replace("'","")
tr_table = str.maketrans("","",specpunc... | 2.71875 | 3 |
tests/test_cli.py | redglue/brickops | 0 | 23676 | import logging
from os.path import expanduser, join
from unittest import mock
import pytest
from click.testing import CliRunner
from configparser import ConfigParser
from apparate.configure import configure
from apparate.cli_commands import upload, upload_and_update
logging.basicConfig(level=logging.INFO)
logger = ... | 2.09375 | 2 |
pg_dicreate.py | zhuyeaini9/pytorch_test | 0 | 23677 | <reponame>zhuyeaini9/pytorch_test<filename>pg_dicreate.py
import torch
import torch.nn.functional as F
import torch.nn as nn
import gym
from gym import spaces
import torch.optim as optim
from torch.distributions import Categorical
import random
import numpy as np
class Net(nn.Module):
def __init__(self, input_spa... | 2.578125 | 3 |
functions/dissectData/lambda_handler.py | zinedine-zeitnot/anomaly-detection | 3 | 23678 | <filename>functions/dissectData/lambda_handler.py<gh_stars>1-10
from data_dissector import DataDissector
def handler(event, _):
switchpoint_trio = DataDissector.dissect_data(data=event['data'])
return {
"switchpoint": switchpoint_trio.switchpoint,
"preSwitchAverage": switchpoint_trio.pre_... | 2.265625 | 2 |
Chapter 3-Regression/2.py | FatiniNadhirah5/Datacamp-Machine-Learning-with-Apache-Spark-2019 | 8 | 23679 | # Flight duration model: Just distance
# In this exercise you'll build a regression model to predict flight duration (the duration column).
# For the moment you'll keep the model simple, including only the distance of the flight (the km column) as a predictor.
# The data are in flights. The first few records are disp... | 4.03125 | 4 |
gipsy/admin.py | marwahaha/gipsy-1 | 10 | 23680 | from django.contrib import admin
class ChildrenInline(admin.TabularInline):
sortable_field_name = "order"
class GipsyMenu(admin.ModelAdmin):
inlines = [ChildrenInline]
exclude = ('parent',)
list_display = ['name', 'order']
ordering = ['order']
def get_queryset(self, request):
"""Ove... | 1.898438 | 2 |
QDeblend/process/host_profiles.py | brandherd/QDeblend3D | 0 | 23681 | import numpy, math
from scipy import special
"""
The Sersic Profile
Formulae for Sersic profile taken from Graham & Driver (2005)
bibcode: 2005PASA...22..118G
"""
class Sersic:
def __init__(self, size, x_c, y_c, mag, n, r_e, e=0., theta=0., osfactor=10,
osradius=2):
self.size = size
... | 2.359375 | 2 |
UnitTests/FullAtomModel/CoordsTransform/test_forward.py | johahi/TorchProteinLibrary | 0 | 23682 | <reponame>johahi/TorchProteinLibrary
import sys
import os
import torch
import numpy as np
from TorchProteinLibrary.FullAtomModel.CoordsTransform import CoordsTranslate, getRandomTranslation, getBBox, CoordsRotate, getRandomRotation
from TorchProteinLibrary.FullAtomModel import Angles2Coords, Coords2TypedCoords
def tes... | 2.390625 | 2 |
tutorials/W0D1_PythonWorkshop1/solutions/W0D1_Tutorial1_Solution_93456241.py | eduardojdiniz/CompNeuro | 2,294 | 23683 |
# Set random number generator
np.random.seed(2020)
# Initialize step_end, n, t_range, v and i
step_end = int(t_max / dt)
n = 50
t_range = np.linspace(0, t_max, num=step_end)
v_n = el * np.ones([n, step_end])
i = i_mean * (1 + 0.1 * (t_max / dt)**(0.5) * (2 * np.random.random([n, step_end]) - 1))
# Loop for step_end ... | 2.671875 | 3 |
src/jsonengine/main.py | youhengzhou/json-crud-engine | 2 | 23684 | <gh_stars>1-10
# JSON engine 21 9 16
# database
# eng.json
# engine
# eng.py
import os
import json
path = os.getcwd() + '\\json_engine_database\\'
path_string = ''
def set_path(string):
global path
path = os.getcwd() + string
def dictionary_kv(dictionary, key, value):
dictionary[key] = va... | 2.6875 | 3 |
tests/coro.py | dshean/sliderule-python | 1 | 23685 | <gh_stars>1-10
# python
import sys
import h5coro
###############################################################################
# DATA
###############################################################################
# set resource
resource = "file:///data/ATLAS/ATL06_20200714160647_02950802_003_01.h5"
# expected sin... | 1.8125 | 2 |
lib/interpreter.py | xraypy/_xraylarch_attic | 1 | 23686 | """
Main Larch interpreter
Safe(ish) evaluator of python expressions, using ast module.
The emphasis here is on mathematical expressions, and so
numpy functions are imported if available and used.
"""
from __future__ import division, print_function
import os
import sys
import ast
import math
import numpy
from . ... | 2.609375 | 3 |
deepinsight/util/tetrode.py | ealmenzar/DeepInsight | 0 | 23687 | <gh_stars>0
"""
DeepInsight Toolbox
© <NAME>
https://github.com/CYHSM/DeepInsight
Licensed under MIT License
"""
import numpy as np
import pandas as pd
import h5py
from . import hdf5
from . import stats
def read_open_ephys(fp_raw_file):
"""
Reads ST open ephys files
Parameters
----------
fp_raw_... | 2.140625 | 2 |
test/scripts/functions.py | JetBrains-Research/jpt-nb-corpus | 3 | 23688 | # Explicit API functions
from api_functions import api_function1, api_function2
from package3 import api_function3
# API Packages
import package1, package2
import package3
from package4 import api_class1
# Defined functions
def defined_function_1(d_f_arg1, d_f_arg2):
a = api_function1(d_f_arg1)
b = (api_fun... | 2.296875 | 2 |
tests/data/test_make_dataset.py | dnsosa/drug-lit-contradictory-claims | 0 | 23689 | """Tests for making datasets for contradictory-claims."""
# -*- coding: utf-8 -*-
import os
import unittest
from contradictory_claims.data.make_dataset import load_drug_virus_lexicons, load_mancon_corpus_from_sent_pairs, \
load_med_nli, load_multi_nli
from .constants import drug_lex_path, mancon_sent_pairs, med... | 2.96875 | 3 |
detection.py | aar0npham/FuryColorDetection | 0 | 23690 | # import modules
import numpy as np
import argparse
import cv2
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-b", "--buffer", type=int, default=64,
help="max buffer size")
args = vars(ap.parse_args())
# define the lower and upper boundaries of ... | 3.03125 | 3 |
topics/migrations/0003_topic_word.py | acdh-oeaw/mmp | 2 | 23691 | # Generated by Django 3.2 on 2021-10-21 19:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topics', '0002_alter_modelingprocess_modeling_type'),
]
operations = [
migrations.AddField(
model_name='topic',
name='... | 1.648438 | 2 |
src/ihtt/__init__.py | dekoza/i-hate-time-tracking | 0 | 23692 | <reponame>dekoza/i-hate-time-tracking
"""
I Hate Time Tracking package.
Get time tracking out of your way.
"""
from typing import List
__all__: List[str] = [] # noqa: WPS410 (the only __variable__ we use)
| 1.195313 | 1 |
tests/base.py | octue/octue-sdk-python | 5 | 23693 | <filename>tests/base.py
import os
import subprocess
import unittest
import uuid
import warnings
from tempfile import TemporaryDirectory, gettempdir
from octue.cloud.emulators import GoogleCloudStorageEmulatorTestResultModifier
from octue.mixins import MixinBase, Pathable
from octue.resources import Datafile, Dataset, ... | 2.265625 | 2 |
sstcam_sandbox/d190717_alpha/plot_wobble_animation_goldfish.py | watsonjj/CHECLabPySB | 0 | 23694 | from CHECLabPy.plotting.setup import Plotter
from CHECLabPy.plotting.camera import CameraImage
from CHECLabPy.utils.files import create_directory
from CHECLabPy.utils.mapping import get_ctapipe_camera_geometry
from sstcam_sandbox import get_plot, get_data
from os.path import join
from matplotlib import pyplot as plt
fr... | 2.015625 | 2 |
tempest/cmd/run.py | Juniper/tempest | 0 | 23695 | # 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, software
# distrib... | 2.40625 | 2 |
src/python/vrprim/photosphere/conv.py | cmbruns/vr_samples | 1 | 23696 | <filename>src/python/vrprim/photosphere/conv.py
"""
Convert spherical panorama in equirectangular format into cubemap format
"""
from math import pi, log2
import numpy
from libtiff import TIFF
import png
import glfw
from OpenGL import GL
from OpenGL.GL import shaders
from OpenGL.GL.EXT.texture_filter_anisotropic impo... | 2.46875 | 2 |
src/controllers/storage.py | koddas/python-oop-consistency-lab | 0 | 23697 | from entities.serializable import Serializable
class Storage:
'''
Storage represents a file storage that stores and retrieves objects
'''
def __init__(self):
pass
def save(self, filename: str, data: Serializable) -> bool:
'''
Stores a serializable object. If the ob... | 3.65625 | 4 |
tests/functional/modules/test_zos_tso_command.py | IBM/zos-core-collection-ftp | 4 | 23698 | from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
import sys
import warnings
import ansible.constants
import ansible.errors
import ansible.utils
import pytest
from pprint import pprint
# The positive path test
def test_zos_tso_command_listuser(ansible_adhoc):
hosts ... | 1.953125 | 2 |
Medium/78.py | Hellofafar/Leetcode | 6 | 23699 | <filename>Medium/78.py
# ------------------------------
# 78. Subsets
#
# Description:
# Given a set of distinct integers, nums, return all possible subsets (the power set).
# Note: The solution set must not contain duplicate subsets.
#
# For example,
# If nums = [1,2,3], a solution is:
# [
# [3],
# [1],
# [2],... | 3.640625 | 4 |