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 |
|---|---|---|---|---|---|---|
adventure-cards/package/main.py | DaneRosa/adventure-cards | 0 | 2100 | import json
def hydrateCards(rawDeckDataPath):
pack = []
rawDeckData = json.load(open(rawDeckDataPath,))
for index, item in enumerate(rawDeckData):
deck = []
# print(index,item)
for i in rawDeckData[item]:
card ={
f'{index}':
{
... | 3 | 3 |
demo/cnn_predict.py | huynhtnhut97/keras-video-classifier | 108 | 2101 | import numpy as np
from keras import backend as K
import os
import sys
K.set_image_dim_ordering('tf')
def patch_path(path):
return os.path.join(os.path.dirname(__file__), path)
def main():
sys.path.append(patch_path('..'))
data_dir_path = patch_path('very_large_data')
model_dir_path = patch_path('... | 2.484375 | 2 |
pyconde/context_processors.py | EuroPython/djep | 5 | 2102 | from django.conf import settings
def less_settings(request):
return {
'use_dynamic_less_in_debug': getattr(settings, 'LESS_USE_DYNAMIC_IN_DEBUG', True)
}
| 1.734375 | 2 |
pmdarima/preprocessing/endog/boxcox.py | tuomijal/pmdarima | 736 | 2103 | <reponame>tuomijal/pmdarima<gh_stars>100-1000
# -*- coding: utf-8 -*-
from scipy import stats
import numpy as np
import warnings
from ...compat import check_is_fitted, pmdarima as pm_compat
from .base import BaseEndogTransformer
__all__ = ['BoxCoxEndogTransformer']
class BoxCoxEndogTransformer(BaseEndogTransforme... | 2.453125 | 2 |
backend/src/baserow/api/user/registries.py | ashishdhngr/baserow | 1 | 2104 | <gh_stars>1-10
from baserow.core.registry import Instance, Registry
class UserDataType(Instance):
"""
The user data type can be used to inject an additional payload to the API
JWT response. This is the response when a user authenticates or refreshes his
token. The returned dict of the `get_user_data` ... | 3.34375 | 3 |
Week 2/code.py | aklsh/EE2703 | 0 | 2105 | '''
-------------------------------------
Assignment 2 - EE2703 (Jan-May 2020)
Done by <NAME> (EE18B122)
Created on 18/01/20
Last Modified on 04/02/20
-------------------------------------
'''
# importing necessary libraries
import sys
import cmath
import numpy as np
import pandas as pd
# To improve readability
C... | 3.21875 | 3 |
Lib/Co.py | M507/Guessing-passwords-using-machine-learning | 6 | 2106 | <gh_stars>1-10
import subprocess
import os.path
"""
Stylish input()
"""
def s_input(string):
return input(string+">").strip("\n")
"""
Execute command locally
"""
def execute_command(command):
if len(command) > 0:
print(command)
proc = subprocess.Popen(command.split(" "), stdout=subprocess.PI... | 3.0625 | 3 |
project3_code/part_0/main.py | rachelbrown347/CS294-26_code | 1 | 2107 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from skimage.exposure import rescale_intensity
from unsharp import *
# Load file and normalize to 0-1
fname = 'iguana.jpg'
im = plt.imread(fname)
if im.mean() >= 1:
im = im/255.
sigma = 5
amplitude = 1.5
imsharp = unsharp_mask(im, sigma, amplitud... | 2.203125 | 2 |
meregistro/apps/registro/models/EstablecimientoDomicilio.py | MERegistro/meregistro | 0 | 2108 | <reponame>MERegistro/meregistro
# -*- coding: utf-8 -*-
from django.db import models
from apps.registro.models.TipoDomicilio import TipoDomicilio
from apps.registro.models.Localidad import Localidad
from apps.registro.models.Establecimiento import Establecimiento
from django.core.exceptions import ValidationError
from ... | 1.8125 | 2 |
python_for_everybody/py2_p4i_old/6.5findslicestringextract.py | timothyyu/p4e-prac | 0 | 2109 | <gh_stars>0
# 6.5 Write code using find() and string slicing (see section 6.10) to extract
# the number at the end of the line below.
# Convert the extracted value to a floating point number and print it out.
text = "X-DSPAM-Confidence: 0.8475";
pos = text.find(':')
text = float(text[pos+1:])
print text | 3.53125 | 4 |
tools/lucid/engine.py | Petr-By/qtpyvis | 3 | 2110 | import logging
logger = logging.getLogger(__name__)
print(f"!!!!!!!!!! getEffectiveLevel: {logger.getEffectiveLevel()} !!!!!!!!!!!!!")
from dltb.base.observer import Observable, change
from network import Network, loader
from network.lucid import Network as LucidNetwork
# lucid.modelzoo.vision_models:
# A module ... | 2.328125 | 2 |
synapse/storage/events.py | natamelo/synapse | 0 | 2111 | # -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018-2019 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 Licens... | 1.242188 | 1 |
dev/buildtool/metrics.py | premm1983/Spinnaker | 0 | 2112 | <reponame>premm1983/Spinnaker<gh_stars>0
# Copyright 2017 Google Inc. 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/LICENSE-2.0
#... | 2.140625 | 2 |
src/python/pants/backend/android/tasks/aapt_builder.py | hythloday/pants | 11 | 2113 | <gh_stars>10-100
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
imp... | 2.15625 | 2 |
fat/fat_bert_nq/ppr/apr_lib.py | kiss2u/google-research | 1 | 2114 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 2.0625 | 2 |
src/optimal_gardening.py | evanlynch/optimal-gardening | 0 | 2115 | <gh_stars>0
import os
import sys
import time
from IPython.display import Image
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sb
sb.set_style("dark")
#### Initial Setup ####
#plant info
plant_info = pd.read_csv('../data/plant_data.csv')
plant_info.index.name = 'plant_index'
... | 2.71875 | 3 |
adv_lib/utils/attack_utils.py | Daulbaev/adversarial-library | 55 | 2116 | import warnings
from collections import OrderedDict
from distutils.version import LooseVersion
from functools import partial
from inspect import isclass
from typing import Callable, Optional, Dict, Union
import numpy as np
import torch
import tqdm
from torch import Tensor, nn
from torch.nn import functional as F
from... | 2.1875 | 2 |
thawSlumpChangeDet/polygons_compare.py | Summer0328/ChangeDet_DL-1 | 3 | 2117 | #!/usr/bin/env python
# Filename: polygons_cd
"""
introduction: compare two polygons in to shape file
authors: <NAME>
email:<EMAIL>
add time: 26 February, 2020
"""
import sys,os
from optparse import OptionParser
# added path of DeeplabforRS
sys.path.insert(0, os.path.expanduser('~/codes/PycharmProjects/DeeplabforRS... | 2.859375 | 3 |
andela_labs/Car Class Lab (OOP)/car.py | brotich/andela_bootcamp_X | 0 | 2118 | <reponame>brotich/andela_bootcamp_X
class Car(object):
"""
Car class that can be used to instantiate various vehicles.
It takes in arguments that depict the type, model, and name
of the vehicle
"""
def __init__(self, name="General", model="GM", car_type="saloon"):
num_of_wh... | 3.875 | 4 |
CV Model/Model - JupyterNotebook/mrcnn/tfliteconverter.py | fcsiba/Smart-Cart | 0 | 2119 | <filename>CV Model/Model - JupyterNotebook/mrcnn/tfliteconverter.py
import tensorflow as tf
# Convert the model.
converter = tf.lite.TFLiteConverter.from_saved_model('model.py')
tflite_model = converter.convert()
open("trash_ai.tflite", "wb").write(tflite_model) | 2.46875 | 2 |
basicapp/cron.py | shivamsinghal212/Url-Shortener | 0 | 2120 | from django_cron import CronJobBase, Schedule
from .models import Link
from django.utils import timezone
class MyCronJob(CronJobBase):
RUN_EVERY_MINS = 1 # every 2 hours
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
code = 'basicapp.cron' # a unique code
def do(self):
current_time = t... | 2.84375 | 3 |
weasyprint/tests/test_stacking.py | Smylers/WeasyPrint | 0 | 2121 | # coding: utf8
"""
weasyprint.tests.stacking
-------------------------
:copyright: Copyright 2011-2012 <NAME> and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, unicode_literals
from ..stacking import StackingContext
from .test_boxes import se... | 2.25 | 2 |
django-magic-link/customers/views.py | industrydive/sourcelist | 5 | 2122 | from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from sesame import utils
from django.core.mail import send_mail
def login_page(request):
if request.method == "POST":
email = request.POST.get("emailId")
user =... | 2.140625 | 2 |
python-lib/config/dss_parameter.py | dataiku/dss-plugin-nlp-analysis | 1 | 2123 | from .custom_check import CustomCheck, CustomCheckError
from typing import Any, List
import logging
logger = logging.getLogger(__name__)
class DSSParameterError(Exception):
"""Exception raised when at least one CustomCheck fails."""
pass
class DSSParameter:
"""Object related to one parameter. It is m... | 3.4375 | 3 |
misc/import_ch_zurich.py | mstarikov/transitfeed | 0 | 2124 | <filename>misc/import_ch_zurich.py
#!/usr/bin/python2.4
# Copyright (C) 2008 Google 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
#... | 2.25 | 2 |
modules/documents.py | rotsee/protokollen | 4 | 2125 | # -*- coding: utf-8 -*-
"""This module contains classes for documents, and lists of documents.
Documents are defined by the document rules in settings.py
A file can contain one or more document. However, a document can
not be constructed from more than one file. This is a limitation,
obvious in cases like ... | 2.796875 | 3 |
tools/amp_segment/ina_speech_segmenter.py | saratkumar/galaxy | 1 | 2126 | #!/usr/bin/env python3
import os
import os.path
import shutil
import subprocess
import sys
import tempfile
import uuid
import mgm_utils
def main():
(root_dir, input_file, json_file) = sys.argv[1:4]
tmpName = str(uuid.uuid4())
tmpdir = "/tmp"
temp_input_file = f"{tmpdir}/{tmpName}.dat"
temp_output_file = f"{tmpd... | 2.234375 | 2 |
csat/django/fields.py | GaretJax/csat | 0 | 2127 | <filename>csat/django/fields.py<gh_stars>0
from lxml import etree
from django import forms
from django.db import models
class XMLFileField(models.FileField):
def __init__(self, *args, **kwargs):
self.schema = kwargs.pop('schema')
super(XMLFileField, self).__init__(*args, **kwargs)
def clean(... | 2.296875 | 2 |
keras_cv_attention_models/yolox/yolox.py | RishabhSehgal/keras_cv_attention_models | 0 | 2128 | import tensorflow as tf
from tensorflow import keras
from keras_cv_attention_models.attention_layers import (
activation_by_name,
batchnorm_with_activation,
conv2d_no_bias,
depthwise_conv2d_no_bias,
add_pre_post_process,
)
from keras_cv_attention_models import model_surgery
from keras_cv_attention_m... | 1.96875 | 2 |
robot-server/tests/service/json_api/test_response.py | mrod0101/opentrons | 0 | 2129 | <filename>robot-server/tests/service/json_api/test_response.py
from pytest import raises
from pydantic import ValidationError
from robot_server.service.json_api.response import (
ResponseDataModel,
ResponseModel,
MultiResponseModel,
)
from tests.service.helpers import ItemResponseModel
def test_attribute... | 2.578125 | 3 |
stickmanZ/__main__.py | MichaelMcFarland98/cse210-project | 1 | 2130 | <filename>stickmanZ/__main__.py
from game.game_view import GameView
from game.menu_view import menu_view
from game import constants
import arcade
SCREEN_WIDTH = constants.SCREEN_WIDTH
SCREEN_HEIGHT = constants.SCREEN_HEIGHT
SCREEN_TITLE = constants.SCREEN_TITLE
window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SC... | 2.078125 | 2 |
neutron/db/migration/alembic_migrations/versions/mitaka/contract/c6c112992c9_rbac_qos_policy.py | congnt95/neutron | 1,080 | 2131 | <gh_stars>1000+
# Copyright 2015 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... | 1.4375 | 1 |
chapter5/ch5_gcp_subscriber.py | ericchou1/network-devops-kafka-up-and-running | 1 | 2132 | from concurrent.futures import TimeoutError
from google.cloud import pubsub_v1
project_id = "pubsub-testing-331300"
subscription_id = "test-sub"
# Number of seconds the subscriber should listen for messages
timeout = 5.0
subscriber = pubsub_v1.SubscriberClient()
# The `subscription_path` method creates a fully qualif... | 2.796875 | 3 |
odoo-13.0/addons/google_drive/models/res_config_settings.py | VaibhavBhujade/Blockchain-ERP-interoperability | 0 | 2133 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
google_drive_authorization_code = fields.Char(string='Authorization Code', config_parame... | 1.992188 | 2 |
dataloaders/loader.py | sanger640/attMPTI | 93 | 2134 | <filename>dataloaders/loader.py
""" Data Loader for Generating Tasks
Author: <NAME>, 2020
"""
import os
import random
import math
import glob
import numpy as np
import h5py as h5
import transforms3d
from itertools import combinations
import torch
from torch.utils.data import Dataset
def sample_K_pointclouds(data_p... | 2.109375 | 2 |
greendoge/types/condition_with_args.py | grayfallstown/greendoge-blockchain | 44 | 2135 | from dataclasses import dataclass
from typing import List
from greendoge.types.condition_opcodes import ConditionOpcode
from greendoge.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class ConditionWithArgs(Streamable):
"""
This structure is used to store parsed CLVM conditi... | 2.53125 | 3 |
homeassistant/components/hunterdouglas_powerview/entity.py | pp81381/home-assistant | 0 | 2136 | """The nexia integration base entity."""
from aiopvapi.resources.shade import ATTR_TYPE
from homeassistant.const import ATTR_MODEL, ATTR_SW_VERSION
import homeassistant.helpers.device_registry as dr
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEnt... | 1.898438 | 2 |
keycast_env/lib/python3.8/site-packages/Xlib/ext/res.py | daxter-army/key-cast | 10 | 2137 | <reponame>daxter-army/key-cast
# Xlib.ext.res -- X-Resource extension module
#
# Copyright (C) 2021 <NAME> <<EMAIL>>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either vers... | 1.539063 | 2 |
rubra/cmdline_args.py | scwatts/rubra | 14 | 2138 | # Process the unix command line of the pipeline.
import argparse
from version import rubra_version
def get_cmdline_args():
return parser.parse_args()
parser = argparse.ArgumentParser(
description='A bioinformatics pipeline system.')
parser.add_argument(
'pipeline',
metavar='PIPELINE_FILE',
type=... | 2.546875 | 3 |
main.py | KH241/Geohashing | 0 | 2139 | import webbrowser
import config
from Generator import Generator
def main():
generator = Generator()
latitude, longitude = generator.getCoordinates()
webbrowser.open(config.api_request.format(latitude, longitude))
if __name__ == '__main__':
main()
| 2.65625 | 3 |
knx-test.py | WAvdBeek/CoAPthon3 | 1 | 2140 | <reponame>WAvdBeek/CoAPthon3
#!/usr/bin/env python
import getopt
import socket
import sys
import cbor
#from cbor2 import dumps, loads
import json
import time
import traceback
from coapthon.client.helperclient import HelperClient
from coapthon.utils import parse_uri
from coapthon import defines
client = None
paths = {... | 2.25 | 2 |
SWIM-Executables/Windows/pyinstaller-2.0 for windows/PyInstaller/hooks/hook-PyQt4.phonon.py | alexsigaras/SWIM | 47 | 2141 | hiddenimports = ['sip', 'PyQt4.QtGui', 'PyQt4._qt']
from PyInstaller.hooks.hookutils import qt4_plugins_binaries
def hook(mod):
mod.binaries.extend(qt4_plugins_binaries('phonon_backend'))
return mod
| 1.226563 | 1 |
PyTradier/data.py | zlopez101/PyTradier | 1 | 2142 | from PyTradier.base import BasePyTradier
from typing import Union
from datetime import datetime
class MarketData(BasePyTradier):
"""All Methods currently only support string API calls, no datetime, bools, etc
"""
def quotes(self, symbols: Union[str, list], greeks: bool = False) -> dict:
"""Get a ... | 2.890625 | 3 |
joulescope_ui/meter_widget.py | Axel-Jacobsen/pyjoulescope_ui | 1 | 2143 | <filename>joulescope_ui/meter_widget.py
# Copyright 2018 Jetperch 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... | 2.046875 | 2 |
rpyc/core/service.py | bbonf/rpyc | 0 | 2144 | """
Services are the heart of RPyC: each side of the connection exposes a *service*,
which define the capabilities available to the other side.
Note that the services by both parties need not be symmetric, e.g., one side may
exposed *service A*, while the other may expose *service B*. As long as the two
can interopera... | 2.75 | 3 |
tests/task/manager_test.py | altenia/taskmator | 2 | 2145 | <filename>tests/task/manager_test.py
import unittest
from testbase import TaskmatorTestBase
from taskmator.task import core, util
from taskmator import context
class ManagerTest(TaskmatorTestBase):
def testManager(self):
print ("Pending")
def main():
unittest.main()
if __name__ == '__main_... | 2.0625 | 2 |
tests/components/zwave_js/test_discovery.py | tbarbette/core | 1 | 2146 | <filename>tests/components/zwave_js/test_discovery.py
"""Test discovery of entities for device-specific schemas for the Z-Wave JS integration."""
async def test_iblinds_v2(hass, client, iblinds_v2, integration):
"""Test that an iBlinds v2.0 multilevel switch value is discovered as a cover."""
node = iblinds_v... | 1.9375 | 2 |
boto3_type_annotations/boto3_type_annotations/guardduty/client.py | cowboygneox/boto3_type_annotations | 119 | 2147 | <filename>boto3_type_annotations/boto3_type_annotations/guardduty/client.py
from typing import Optional
from botocore.client import BaseClient
from typing import Dict
from typing import Union
from botocore.paginate import Paginator
from botocore.waiter import Waiter
from typing import List
class Client(BaseClient):
... | 2.140625 | 2 |
test/workload/tpch_loop_workload_test.py | ChenYi015/Raven | 1 | 2148 | <gh_stars>1-10
# Copyright 2021 Raven Authors. 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/LICENSE-2.0
#
# Unless required by app... | 2.421875 | 2 |
Final-Project/server/art/serializers.py | wendy006/Web-Dev-Course | 0 | 2149 | from rest_framework import serializers
from .models import *
class CollectionSerializer(serializers.ModelSerializer):
class Meta:
model = Collection
fields = ('collectionID', 'name', 'display_name', 'description', 'img_url')
class ArtSerializer(serializers.ModelSerializer):
img_url = ... | 2.40625 | 2 |
google/cloud/google_cloud_cpp_common_unit_tests.bzl | joezqren/google-cloud-cpp | 0 | 2150 | <filename>google/cloud/google_cloud_cpp_common_unit_tests.bzl
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#... | 1.210938 | 1 |
api/tests/ver1/test_base.py | codacy-badger/politico-api | 0 | 2151 | <filename>api/tests/ver1/test_base.py
import unittest
from api import create_app
class TestBase(unittest.TestCase):
"""Default super class for api ver 1 tests"""
# setup testing
def setUp(self):
self.app = create_app('testing')
self.client = self.app.test_client()
self.item_list = ... | 2.53125 | 3 |
socialdistribution/app/templatetags/filters.py | CMPUT404-Project-Group/CMPUT404-Group-Project | 0 | 2152 | from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import SafeString
import markdown
import urllib
register = template.Library()
@register.filter
def strip_space(value):
return value.replace(' ', '')
@register.filter
@stringfilter
def commonmark(value... | 2.28125 | 2 |
alipay/aop/api/domain/MetroOdItem.py | antopen/alipay-sdk-python-all | 213 | 2153 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.CloudbusUserInfo import CloudbusUserInfo
class MetroOdItem(object):
def __init__(self):
self._dest_geo = None
self._od = None
self._time = None
... | 2.046875 | 2 |
djangocms_redirect/migrations/0003_auto_20190810_1009.py | vsalat/djangocms-redirect | 0 | 2154 | <reponame>vsalat/djangocms-redirect
# Generated by Django 2.2.4 on 2019-08-10 08:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangocms_redirect', '0002_auto_20170321_1807'),
]
operations = [
migrations.AddField(
model... | 1.867188 | 2 |
octopart/scrape_octopart.py | nicholaschiang/dl-datasheets | 0 | 2155 | #! /usr/bin/env python
import sys
import json
import urllib
import urllib2
import time
import argparse
import re
# Category ID for Discrete Semiconductors > Transistors > BJTs
TRANSISTOR_ID = b814751e89ff63d3
def find_total_hits(search_query):
"""
Function: find_total_hits
--------------------
Return... | 3.1875 | 3 |
extras/python/fogbench/__main__.py | foglamp/FogLAMP | 65 | 2156 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" fogbench -- a Python script used to test FogLAMP.
The objective is to simulate payloads for input, REST and other requests against one or
more FogLAMP instances. This version of fogbench is meant ... | 2.28125 | 2 |
qiskit/ignis/mitigation/measurement/filters.py | paulineollitrault/qiskit-ignis | 182 | 2157 | <reponame>paulineollitrault/qiskit-ignis<gh_stars>100-1000
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 a... | 2.09375 | 2 |
pymatgen/analysis/graphs.py | Roy027/pymatgen | 0 | 2158 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Module for graph representations of crystals.
"""
import copy
import logging
import os.path
import subprocess
import warnings
from collections import defaultdict, namedtuple
from itertools import combinati... | 2.1875 | 2 |
maple/backend/singularity/__init__.py | akashdhruv/maple | 0 | 2159 | from . import image
from . import container
from . import system
| 1.101563 | 1 |
articles/views.py | Ahmed-skb/blogyfy | 0 | 2160 | from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import Article
from django.contrib.auth.decorators import login_required
from . import forms
def Articles(request):
articles = Article.objects.all().order_by('date')
return render(request, 'articles/article_list.htm... | 2.265625 | 2 |
sifter/grammar/grammar.py | russell/sifter | 0 | 2161 | <gh_stars>0
# Parser based on RFC 5228, especially the grammar as defined in section 8. All
# references are to sections in RFC 5228 unless stated otherwise.
import ply.yacc
import sifter.grammar
from sifter.grammar.lexer import tokens
import sifter.handler
import logging
__all__ = ('parser',)
def parser(**kwargs)... | 2.59375 | 3 |
multidoc_mnb.py | dropofwill/author-attr-experiments | 2 | 2162 | <gh_stars>1-10
from sklearn import datasets
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.cross_validation import train_test_split
from sklearn.cross_validation import cross_val_score
from sklearn.cross_validation import ShuffleSpli... | 2.625 | 3 |
tabular/__init__.py | yamins81/tabular | 6 | 2163 | import io
import fast
import spreadsheet
import tab
import utils
import web
from io import *
from fast import *
from spreadsheet import *
from tab import *
from utils import *
from web import *
__all__ = []
__all__.extend(io.__all__)
__all__.extend(fast.__all__)
__all__.extend(spreadsheet.__all__)
__all__.extend(tab.... | 1.320313 | 1 |
smipyping/_targetstable.py | KSchopmeyer/smipyping | 0 | 2164 | # (C) Copyright 2017 Inova Development Inc.
# 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/LICENSE-2.0
#
# Unless required by appl... | 1.742188 | 2 |
dev/Code/Framework/AzFramework/CodeGen/AzEBusInline.py | jeikabu/lumberyard | 1,738 | 2165 | #
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... | 1.90625 | 2 |
QUANTAXIS/QASU/crawl_eastmoney.py | QUANTAXISER/QUANTAXIS | 1 | 2166 | import os
from QUANTAXIS.QASetting import QALocalize
#from QUANTAXIS_CRAWLY.run_selenium_alone import (read_east_money_page_zjlx_to_sqllite, open_chrome_driver, close_chrome_dirver)
from QUANTAXIS_CRAWLY.run_selenium_alone import *
import urllib
import pandas as pd
import time
from QUANTAXIS.QAUtil import (DATABASE)
... | 2.65625 | 3 |
wsgi.py | javicacheiro/salt-git-synchronizer-proxy | 0 | 2167 | #!/usr/bin/env python
import logging
import sys
from app import app as application
def setup_flask_logging():
# Log to stdout
handler = logging.StreamHandler(sys.stdout)
# Log to a file
#handler = logging.FileHandler('./application.log')
handler.setLevel(logging.INFO)
handler.setFormatter(logg... | 2.671875 | 3 |
game/base/enemy.py | PythonixCoders/PyWeek29 | 8 | 2168 | <gh_stars>1-10
#!/usr/bin/env python
from game.base.being import Being
class Enemy(Being):
def __init__(self, app, scene, **kwargs):
super().__init__(app, scene, **kwargs)
self.friendly = False
| 2.265625 | 2 |
main/rates/migrations/0002_auto_20170625_1510.py | Hawk94/coin_tracker | 0 | 2169 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-25 15:10
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rates', '0001_initial'),
]
operations = [
migrations.RenameField(
model... | 1.6875 | 2 |
setup.py | dojeda/quetzal-openapi-client | 0 | 2170 | # coding: utf-8
"""
Quetzal API
Quetzal: an API to manage data files and their associated metadata.
OpenAPI spec version: 0.5.0
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from setuptools import setup, find_packages # noqa: H301
NAME = "quetzal-openapi-client"
VERSION = ... | 1.539063 | 2 |
youtube_dl/extractor/turner.py | jonyg80/youtube-dl | 66,635 | 2171 | # coding: utf-8
from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..compat import compat_str
from ..utils import (
fix_xml_ampersands,
xpath_text,
int_or_none,
determine_ext,
float_or_none,
parse_duration,
xpath_attr,
update_url_query,
Extrac... | 2.078125 | 2 |
ml/sandbox/00-data.py | robk-dev/algo-trading | 1 | 2172 | from alpha_vantage.timeseries import TimeSeries
from pprint import pprint
import json
import argparse
def save_dataset(symbol='MSFT', time_window='daily_adj'):
credentials = json.load(open('creds.json', 'r'))
api_key = credentials['av_api_key']
print(symbol, time_window)
ts = TimeSeries(key=api_key, o... | 3.046875 | 3 |
tests/zpill.py | al3pht/cloud-custodian | 2,415 | 2173 | <gh_stars>1000+
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import fnmatch
from io import StringIO
import json
import os
import shutil
import zipfile
import re
from datetime import datetime, timedelta, tzinfo
from distutils.util import strtobool
import boto3
import placebo
from botoc... | 1.6875 | 2 |
flexget/tests/test_next_series_seasons.py | metaMMA/Flexget | 0 | 2174 | <gh_stars>0
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
from flexget.entry import Entry
# TODO Add more standard tests
class TestNextSeriesSeasonSeasonsPack(object):
_config = """
templat... | 1.78125 | 2 |
pymatgen/analysis/wulff.py | hpatel1567/pymatgen | 1 | 2175 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module define a WulffShape class to generate the Wulff shape from
a lattice, a list of indices and their corresponding surface energies,
and the total area and volume of the wulff shape,the weighted su... | 3.28125 | 3 |
ccg/supertagger/any2int.py | stanojevic/ccgtools | 0 | 2176 |
class Any2Int:
def __init__(self, min_count: int, include_UNK: bool, include_PAD: bool):
self.min_count = min_count
self.include_UNK = include_UNK
self.include_PAD = include_PAD
self.frozen = False
self.UNK_i = -1
self.UNK_s = "<UNK>"
self.PAD_i = -2
... | 3.171875 | 3 |
app/sensor.py | sosprz/nettemp | 51 | 2177 | <gh_stars>10-100
from app import app
from flask import Flask, request, jsonify, g
import sqlite3
import os
import json
from random import randint
from flask_jwt_extended import jwt_required
import datetime
from flask_mysqldb import MySQL
mysql = MySQL()
def get_db(rom):
db = getattr(g, '_database', None)
if db... | 2.625 | 3 |
tests/either_catch_test.py | funnel-io/python-on-rails | 1 | 2178 | from python_on_rails.either import as_either, Failure, Success
@as_either(TypeError)
def add_one(x):
return x + 1
@as_either()
def times_five(x):
return x * 5
def test_success_executes_bindings():
result = Success(1).bind(add_one).bind(times_five)
assert isinstance(result, Success)
assert resu... | 2.75 | 3 |
ServerSide/models.py | Coullence/DRF_Percels-Couriers_API_V.0.0.2 | 0 | 2179 | from django.db import models
# Create your models here.
# Station
class Stations(models.Model):
stationName = models.CharField(max_length=100)
stationLocation = models.CharField(max_length=100)
stationStaffId = models.CharField(max_length=100)
date = models.DateTimeField(auto_now_add=True)
d... | 2.234375 | 2 |
tao_compiler/mlir/disc/tests/glob_op_test.bzl | JamesTheZ/BladeDISC | 328 | 2180 | # Test definitions for Lit, the LLVM test runner.
#
# This is reusing the LLVM Lit test runner in the interim until the new build
# rules are upstreamed.
# TODO(b/136126535): remove this custom rule.
"""Lit runner globbing test
"""
load("//tensorflow:tensorflow.bzl", "filegroup")
load("@bazel_skylib//lib:paths.bzl", "... | 1.554688 | 2 |
build-scripts/PackageCheckHelpers.py | yulicrunchy/JALoP | 4 | 2181 | """
These are functions to add to the configure context.
"""
def __checkCanLink(context, source, source_type, message_libname, real_libs=[]):
"""
Check that source can be successfully compiled and linked against real_libs.
Keyword arguments:
source -- source to try to compile
source_type -- type of source file, ... | 2.421875 | 2 |
src/transformers/modeling_tf_pytorch_utils.py | ari-holtzman/transformers | 5,129 | 2182 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, <NAME>. 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 Lic... | 2.28125 | 2 |
hail/python/test/hail/helpers.py | mitochon/hail | 0 | 2183 | <gh_stars>0
import os
from timeit import default_timer as timer
import unittest
import pytest
from decorator import decorator
from hail.utils.java import Env
import hail as hl
from hail.backend.local_backend import LocalBackend
_initialized = False
def startTestHailContext():
global _initialized
if not _ini... | 1.992188 | 2 |
src/entity_linker/models/figer_model/labeling_model.py | mjstrobl/WEXEA | 10 | 2184 | <filename>src/entity_linker/models/figer_model/labeling_model.py
"""
Modifications copyright (C) 2020 <NAME>
"""
import time
import tensorflow as tf
import numpy as np
from entity_linker.models.base import Model
class LabelingModel(Model):
"""Unsupervised Clustering using Discrete-State VAE"""
def __init__(... | 2.0625 | 2 |
python/molecular_diameter.py | wutobias/collection | 2 | 2185 | <gh_stars>1-10
#!/usr/bin/env python
import sys
import parmed as pmd
import numpy as np
from scipy.spatial import distance
if len(sys.argv) < 2:
print "Usage: molecular_diameter.py <mymolecule.mol2>"
exit(1)
mol = pmd.load_file(sys.argv[1])
crds = mol.coordinates
dist = distance.cdist(crds, crds, 'euclidean')
pr... | 2.453125 | 2 |
examples/text_classification/yelp_reviews_polarity/train.py | liorshk/simpletransformers | 3,151 | 2186 | <reponame>liorshk/simpletransformers<gh_stars>1000+
import sys
import pandas as pd
from simpletransformers.classification import ClassificationModel
prefix = "data/"
train_df = pd.read_csv(prefix + "train.csv", header=None)
train_df.head()
eval_df = pd.read_csv(prefix + "test.csv", header=None)
eval_df.head()
tra... | 2.765625 | 3 |
LoadGraph.py | mahdi-zafarmand/SNA | 0 | 2187 | <reponame>mahdi-zafarmand/SNA
import networkx as nx
import os.path
def load_graph(path, weighted=False, delimiter='\t', self_loop=False):
graph = nx.Graph()
if not os.path.isfile(path):
print("Error: file " + path + " not found!")
exit(-1)
with open(path) as file:
for line in file.readlines():
w = 1.0
... | 3.09375 | 3 |
mayan/apps/document_signatures/models.py | wan1869/dushuhu | 0 | 2188 | import logging
import uuid
from django.db import models
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from model_utils.managers import InheritanceManager
from mayan.apps.django_gpg.exceptions import VerificationError
from mayan.ap... | 2.15625 | 2 |
scripts/sync_reports_config.py | ramezrawas/galaxy-1 | 6 | 2189 | from ConfigParser import ConfigParser
from sys import argv
REPLACE_PROPERTIES = ["file_path", "database_connection", "new_file_path"]
MAIN_SECTION = "app:main"
def sync():
# Add or replace the relevant properites from galaxy.ini
# into reports.ini
reports_config_file = "config/reports.ini"
if len(arg... | 2.9375 | 3 |
src/gausskernel/dbmind/xtuner/test/test_ssh.py | wotchin/openGauss-server | 1 | 2190 | # Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS... | 1.828125 | 2 |
models/utils.py | wyshi/Unsupervised-Structure-Learning | 34 | 2191 | <reponame>wyshi/Unsupervised-Structure-Learning<gh_stars>10-100
# Original work Copyright (C) 2017 <NAME>, Carnegie Mellon University
# Modified work Copyright 2018 <NAME>.
import tensorflow as tf
import numpy as np
from nltk.translate.bleu_score import sentence_bleu
from nltk.translate.bleu_score import SmoothingFunc... | 2.484375 | 2 |
gluoncv/data/transforms/block.py | Kh4L/gluon-cv | 5,447 | 2192 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2.125 | 2 |
explore.py | lribiere/explore-mit-bih-arrhythmia-db | 3 | 2193 | import plotly.graph_objects as go
import streamlit as st
import pandas as pd
from utils import *
import glob
import wfdb
import os
ANNOTATIONS_COL_NAME = 'annotations'
'''
# MIT-BIH Arrhythmia DB Exploration
'''
record_ids = [os.path.basename(file)[:-4] for file in glob.glob('data/*.dat')]
if len(record_ids) == 0:
... | 2.5625 | 3 |
release/stubs.min/System/__init___parts/CharEnumerator.py | tranconbv/ironpython-stubs | 0 | 2194 | class CharEnumerator(object):
""" Supports iterating over a System.String object and reading its individual characters. This class cannot be inherited. """
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return CharEnumerator()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
de... | 3.125 | 3 |
src/home_automation_hub/config.py | levidavis/py-home | 0 | 2195 | <filename>src/home_automation_hub/config.py
from .config_store import ConfigStore
config = ConfigStore()
config.set_mqtt_broker("mqtt", 1883)
config.set_redis_config("redis", 6379, 0)
| 1.296875 | 1 |
Harpe-website/website/contrib/communication/utils.py | Krozark/Harpe-Website | 0 | 2196 | # -*- coding: utf-8 -*-
import socket as csocket
from struct import pack,unpack
from website.contrib.communication.models import *
def enum(**enums):
return type('Enum', (), enums)
class Socket:
Dommaine = enum(IP=csocket.AF_INET,LOCAL=csocket.AF_UNIX)
Type = enum(TCP=csocket.SOCK_STREAM, UDP=csocket.SOCK... | 2.78125 | 3 |
traitarm/reconstruction/visualize_recon.py | hzi-bifo/Model-T | 1 | 2197 | import pandas as pd
import ete2
from ete2 import faces, Tree, AttrFace, TreeStyle
import pylab
from matplotlib.colors import hex2color, rgb2hex, hsv_to_rgb, rgb_to_hsv
kelly_colors_hex = [
0xFFB300, # Vivid Yellow
0x803E75, # Strong Purple
0xFF6800, # Vivid Orange
0xA6BDD7, # Very Light Blue
0xC100... | 2.4375 | 2 |
scripts/misc/operator_condition_number_scipy.py | volpatto/firedrake_scripts | 5 | 2198 | import attr
from firedrake import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from scipy.linalg import svd
from scipy.sparse.linalg import svds
from scipy.sparse import csr_matrix
from slepc4py import SLEPc
import pandas as pd
from tqdm import tqdm
import os
matplotlib.use('Agg')
@attr.s
c... | 2.328125 | 2 |
pydeap/feature_extraction/_time_domain_features.py | Wlgls/pyDEAP | 0 | 2199 | <reponame>Wlgls/pyDEAP<gh_stars>0
# -*- encoding: utf-8 -*-
'''
@File :_time_domain_features.py
@Time :2021/04/16 20:02:55
@Author :wlgls
@Version :1.0
'''
import numpy as np
def statistics(data, combined=True):
"""Statistical features, include Power, Mean, Std, 1st differece, Normalized 1s... | 2.8125 | 3 |