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 |
|---|---|---|---|---|---|---|
contenido/tests/HU028_test.py | slinan/border | 0 | 12786451 | from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from contenido.models import Audio
# Create your tests here.
class ContenidoTests(TestCase):
def setUp(self):
# Every test needs access to the request factory.
user = User.objects.create_u... | 2.484375 | 2 |
model/create_model_retinanet.py | Abdumaleek/SDK | 1 | 12786452 | import os
import torch
import numpy as np
from pytorch_retinanet.loss import FocalLoss
from pytorch_retinanet.retinanet import RetinaNet
from pytorch_retinanet.encoder import DataEncoder
import local_config
from braille_utils import label_tools
def create_model_retinanet(params, device):
'''
Creates model an... | 2.15625 | 2 |
bomberman/model/events.py | raphaelreme/bomberman | 0 | 12786453 | <reponame>raphaelreme/bomberman<filename>bomberman/model/events.py<gh_stars>0
"""All the events used by the model based on the observer/observable event."""
from __future__ import annotations
from . import entity
from ..designpattern.event import Event
class MazeStartEvent(Event):
"""At each new maze"""
class... | 2.8125 | 3 |
aashe_bulletin/migrations/0001_use_ulysses_for_historical_issues.py | AASHE/aashe-bulletin | 0 | 12786454 | <reponame>AASHE/aashe-bulletin
# -*- coding: utf-8 -*-
"""For all extant issues, use 'ulysses.html' for the HTML template.
Previous templates expect one Category per Post; ulysses.html handles
multiple Categories per Post.
Since supporting multiple Categories per Post required a schema
change, historical HTML templat... | 1.984375 | 2 |
api/main.py | manucabral/CODAVI | 11 | 12786455 | <filename>api/main.py
import pandas as pd
import matplotlib.pyplot as plt
import mysql.connector
import base64
import io
from flask import Flask
from datetime import datetime
app = Flask(__name__)
FECHA_ACTUAL = datetime.now().date().isoformat()
def obtenerDatosVacuna():
try:
url = 'https://sisa.msal.gov... | 3.046875 | 3 |
vcflat/tests/test_HeaderExtraction/test_populatevcfheader.py | arontommi/VCFlat | 4 | 12786456 | <gh_stars>1-10
import os
from vcflat.HeaderExtraction import VcfHeader
def get_input(samples_in_header=None):
test_data_dir = os.path.join(os.path.dirname(__file__), "..", "test_data")
i = os.path.join(test_data_dir, "test.snpeff.vcf")
vcfh = VcfHeader(i, samples_in_header=samples_in_header)
return ... | 2.46875 | 2 |
nova_powervm/tests/virt/powervm/tasks/test_network.py | UbuntuEvangelist/nova-powervm | 0 | 12786457 | # Copyright 2015 IBM Corp.
#
# 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 a... | 1.828125 | 2 |
wce_triage/lib/disk_images.py | pfrouleau/wce-triage-v2 | 3 | 12786458 | # Copyright (c) 2019 <NAME>
# MIT license - see LICENSE
"""disk_image scans the disk image candidate directories and returns availabe disk images for loading.
"""
import os, datetime, json, traceback
from ..lib.util import get_triage_logger, init_triage_logger
tlog = get_triage_logger()
global WCE_IMAGES
WCE_IMAGES =... | 2.765625 | 3 |
app/mod_repo/package_manager.py | v-yussupov/hdtapps-prototype | 2 | 12786459 | <reponame>v-yussupov/hdtapps-prototype<filename>app/mod_repo/package_manager.py
import json
import os
from app.mod_repo.models import *
from app.mod_repo.dockerfile_generator import Dockerfile
def read_package_specification(temp_app_dir):
try:
pkg_spec_path = os.path.join(temp_app_dir, "app-spec.json")
... | 2.03125 | 2 |
examples/calc_wer.py | jumon/pywer | 2 | 12786460 | import pywer
references = [
"this is a simple python package",
"it calculates word error rate",
"it can also calculate cer",
]
hypotheses = [
"this is the simple python package",
"it calculates word error",
"it can also calculate see er",
]
wer = pywer.wer(references, hypotheses)
cer = pywer.c... | 2.25 | 2 |
fondat/aws/cloudwatch.py | fondat/fondat-aws | 0 | 12786461 | <gh_stars>0
"""Fondat module for AWS CloudWatch."""
import logging
from collections import deque
from collections.abc import Iterable
from datetime import datetime
from fondat.aws import Service
from fondat.data import datacls
from fondat.resource import resource, operation, mutation
from fondat.security import Polic... | 2.171875 | 2 |
dnn.py | OSU-slatelab/mask-vs-map | 1 | 12786462 | <gh_stars>1-10
import tensorflow as tf
import numpy as np
import tfsignal
class DNN():
"""
ResNet-style architecture for speech denoising.
"""
def __init__(self,
inputs,
output_dim,
layers = 2,
units = 2048,
context = 5,
activation = tf.nn.r... | 3.171875 | 3 |
mne/layouts/layout.py | mluessi/mne-python | 1 | 12786463 | <filename>mne/layouts/layout.py
import os.path as op
import numpy as np
class Layout(object):
"""Sensor layouts"""
def __init__(self, kind='Vectorview-all', path=None):
"""
Parameters
----------
kind : 'Vectorview-all' | 'CTF-275' | 'Vectorview-grad' | 'Vectorview-mag'
... | 2.609375 | 3 |
logicmonitor_sdk/models/device_data_source.py | JeremyTangCD/lm-sdk-python | 0 | 12786464 | # coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... | 2.03125 | 2 |
ccvpn/models/types.py | CCrypto/ccvpn | 81 | 12786465 | <filename>ccvpn/models/types.py<gh_stars>10-100
from sqlalchemy import TypeDecorator, UnicodeText, String
from sqlalchemy.ext.mutable import Mutable
from sqlalchemy.dialects import postgresql # INET
import json
class JSONEncodedDict(TypeDecorator):
impl = UnicodeText
def process_bind_param(self, value, dial... | 2.21875 | 2 |
cyra/cyradoc.py | Theta-Dev/Cyra | 0 | 12786466 | <reponame>Theta-Dev/Cyra
from typing import List
import importlib
from sphinx.application import Sphinx
from sphinx.util import logging
from docutils import nodes
from docutils.parsers.rst import Directive, directives
from docutils.statemachine import StringList
import cyra
logger = logging.getLogger(__name__)
cla... | 1.96875 | 2 |
dipy/reconst/dki_micro.py | nasimanousheh/dipy | 8 | 12786467 | <reponame>nasimanousheh/dipy<filename>dipy/reconst/dki_micro.py
#!/usr/bin/python
""" Classes and functions for fitting the DKI-based microstructural model """
from __future__ import division, print_function, absolute_import
import numpy as np
from dipy.reconst.dti import (lower_triangular, from_lower_triangular,
... | 2.671875 | 3 |
face_recognize.py | nadeengamage/face-recognition | 0 | 12786468 | import cv2, sys, os
import numpy as np
haar_file = 'haarcascade_frontalface_default.xml'
datasets = 'datasets'
print('Recognizing Face Please Be in sufficient Lights...')
(images, lables, names, id) = ([], [], {}, 0)
for (subdirs, dirs, files) in os.walk(datasets):
for subdir in dirs:
names[id] = subdir
su... | 2.734375 | 3 |
autumn/tools/inputs/covid_au/fetch.py | monash-emu/AuTuMN | 14 | 12786469 | <filename>autumn/tools/inputs/covid_au/fetch.py
"""
This file imports Google mobility data and saves it to disk as a CSV.
"""
import os
import pandas as pd
from autumn.settings import INPUT_DATA_PATH
# From covid19data.com.au GitHub https://github.com/M3IT/COVID-19_Data
DATA_URL = "https://raw.githubusercontent.com/... | 2.703125 | 3 |
diabetesmanager/__init__.py | diabetes-manager/data-science | 0 | 12786470 | <gh_stars>0
"""Entry point for Diabetes Manager flask application."""
from .app import create_app
APP = create_app()
| 1.03125 | 1 |
draw_bar.py | IndexFziQ/nn4nlp-concepts | 440 | 12786471 | # import libraries
import matplotlib
matplotlib.use('Agg')
import pandas as pd
import matplotlib.pyplot as plt
import argparse
from collections import defaultdict
#%matplotlib inline
# set font
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = 'Helvetica'
# set the style of the axes and the... | 2.765625 | 3 |
tests/test_online_attributes.py | anetschka/duden | 0 | 12786472 | <filename>tests/test_online_attributes.py
# -*- coding: utf-8 -*-
"""
Test if words currently available online parse as expected
"""
import os
from collections import namedtuple
import pytest
import yaml
from duden.search import get
TEST_DATA_DIR = 'tests/test_data'
WordTestRecord = namedtuple('WordTestRecord', ["... | 2.78125 | 3 |
runner.py | erensezener/aima-based-irl | 12 | 12786473 | """
Author: <NAME> (<EMAIL>)
Date: April 4, 2014
Description: Runs the BIRL algorithm multiple times.
Status: Works correctly.
Dependencies:
Known bugs: -
"""
# from birl import *
from functools import partial
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
from modified_... | 2.515625 | 3 |
fixipy/__init__.py | Jaydabi/pyfix | 0 | 12786474 | <gh_stars>0
from .Message import Message
| 1.085938 | 1 |
accounts.py | qwerith/Weather-Project | 0 | 12786475 | <gh_stars>0
import psycopg2
import os
import re
import string
import random
import logging
from dotenv import load_dotenv, find_dotenv
from flask_bcrypt import Bcrypt
from flask import redirect, session
bcrypt = Bcrypt()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
formatter = logging.Formatter(... | 2.34375 | 2 |
resetpwd/models.py | catbei2020/ad-password-self-service | 1 | 12786476 | <filename>resetpwd/models.py
from django.db import models
from django import forms
from django.contrib import auth
| 1.304688 | 1 |
vk_bot/mods/yourphoto/getcommand.py | triangle1984/GLaDOS | 3 | 12786477 | <gh_stars>1-10
from vk_bot.core.modules.basicplug import BasicPlug
from vk_bot.core.modules.othermethods import OtherMethod
from vk_bot.core.sql.vksql import *
class Getcommand(BasicPlug, OtherMethod):
doc = "вытащить команду"
types = 'commandb'
@staticmethod
def getcommand(uid, command):
if boo... | 2.296875 | 2 |
src/graphql/document/field_query.py | btrekkie/graphql | 0 | 12786478 | class GraphQlFieldQuery(object):
"""A request for the value of a GraphQL object's field.
dict<basestring, object> args - The arguments to the field. The
entries are the Python object representations of the arguments'
values, with GraphQlVariableReference objects for variable
references... | 2.546875 | 3 |
01-Lesson-Plans/03-Python/3/Activities/08-Par_GraduatingFunctions/Unsolved/graduation_functions.py | anirudhmungre/sneaky-lessons | 0 | 12786479 | <reponame>anirudhmungre/sneaky-lessons
import os
import csv
# Path to collect data from the Resources folder
# Define the function and have it accept the 'state_data' as its sole parameter
# Find the total students
# Find the total graduates
# Find the public school graduation rate
# Remember that some states d... | 4.15625 | 4 |
examples/Multiple-time-series.py | KikeM/time-series-generator | 6 | 12786480 | # ---
# jupyter:
# jupytext:
# formats: ipynb,md,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.4.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# ... | 2.515625 | 3 |
besspin/cyberPhys/cyberphyslib/tests/test_canout.py | mikkowus/BESSPIN-Tool-Suite | 0 | 12786481 | """
Project: SSITH CyberPhysical Demonstrator
Name: test_canout.py
Author: <NAME>
Date: 08 April 2021
Tests for the cyberphys can location poller
"""
import cyberphyslib.demonstrator.can_out as ccout
import cyberphyslib.demonstrator.component as ccomp
from cyberphyslib.demonstrator.handler import ComponentHandler
impo... | 2.140625 | 2 |
openid_wargaming/verification.py | mac-developer/WargamingOpenID | 4 | 12786482 | <filename>openid_wargaming/verification.py
"""OpenID 2.0 - Verifiying Assertions
Ref: https://openid.net/specs/openid-authentication-2_0.html#verification
"""
from urllib.parse import urlparse, parse_qs, urlencode
from requests import post
from .exceptions import BadOpenIDReturnTo, OpenIDFailReturnURLVerification
fr... | 3.015625 | 3 |
src/aeml/models/tcn/forecast.py | kjappelbaum/aeml | 0 | 12786483 | # -*- coding: utf-8 -*-
from functools import partial
import numpy as np
import pandas as pd
def summarize_results(results):
values = []
for df in results:
values.append(df.pd_dataframe().values)
df = df.pd_dataframe()
columns = df.columns
return (
pd.DataFrame(np.mean(values, ... | 2.5625 | 3 |
app.py | TwilioDevEd/sync-quickstart-python | 2 | 12786484 | <reponame>TwilioDevEd/sync-quickstart-python<gh_stars>1-10
import os
from flask import Flask, jsonify, request, send_from_directory
from faker import Factory
from twilio.jwt.access_token import AccessToken
from twilio.jwt.access_token.grants import SyncGrant
app = Flask(__name__)
fake = Factory.create()
@app.route('/... | 2.4375 | 2 |
{{ cookiecutter.package_name }}/tests/test_config.py | triaxtec/fastapi-serverless-cookiecutter | 15 | 12786485 | def test_get_config_aws_load(mocker):
from {{ cookiecutter.module_name }} import config
AWSSource = mocker.patch.object(config, "AWSSource", return_value={"custom_key": "custom_value"})
mocker.patch.object(config, "_app_config", None)
config = config.get_config({"env": "testing"})
AWSSource.asser... | 2.25 | 2 |
Classes and Inheritance.py | PiusLucky/python-classes | 1 | 12786486 | <reponame>PiusLucky/python-classes
# Example of a simple class
class Car:
tire_numbers = 4
sterling_color = "Black"
speed = "100–120 km/h"
# simple class with one method
class Car:
tire_numbers = 4
sterling_color = "Black"
speed = "100–120 km/h"
def check_speed(self):
return self.s... | 4.25 | 4 |
pytheas/__about__.py | benvial/pytheas | 10 | 12786487 | from datetime import date
__version__ = "1.3.1"
__author__ = u"<NAME>"
__author_email__ = "<EMAIL>"
__copyright__ = u"Copyright (c) 2017-{}, {} <{}>".format(
date.today().year, __author__, __author_email__
)
__website__ = "https://benvial.github.io/pytheas"
__license__ = "License :: OSI Approved :: MIT License"
__... | 1.734375 | 2 |
cl_astnn.py | yemao616/Cross-Lingual-Adversarial-Domain-Adaptation | 0 | 12786488 | <filename>cl_astnn.py
import torch
import torch.nn as nn
from torch.autograd import Variable
from tlstm import TLSTM
from astnn import ASTNN
class CrossLing(nn.Module):
"""
Cross-Language ASTNN Model
"""
def __init__(self, args):
super(CrossLing, self).__init__()
self.with_target_doma... | 2.828125 | 3 |
top/api/rest/WdtStatSalesBySpecShopWarehouseQueryRequest.py | SAMZONG/taobao-sdk-python3 | 0 | 12786489 | '''
Created by auto_sdk on 2020.09.01
'''
from top.api.base import RestApi
class WdtStatSalesBySpecShopWarehouseQueryRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.consign_date = None
self.sid = None
def getapiname(self):
return 'h... | 1.65625 | 2 |
Notes/Sprint3/GraphBFT.py | mark-morelos/CS_Notes | 1 | 12786490 | # pseudocode
# Breadth-First Search
"""
procedure BFS(G, root) is
let Q be a queue
label root as discovered
Q.enqueue(root)
while Q is not empty do
v := Q.dequeue()
if v is the goal then
return v
for all edges from v to w in G.adjacentEdges(v) do
if w is ... | 3.96875 | 4 |
info/examples/format_conversion/convert_pdb.py | stxinsite/geomm | 3 | 12786491 | <reponame>stxinsite/geomm<gh_stars>1-10
# make sure to install dependencies in 'conversion.requirements.txt'
import os
import os.path as osp
import shutil
import sqlite3
import numpy as np
import pandas as pd
import tables as pytables
import mdtraj as mdj
from wepy.util.mdtraj import mdtraj_to_json_topology
from wep... | 2.3125 | 2 |
RCNN_modified.py | CassieXueq/GitTest | 0 | 12786492 | <reponame>CassieXueq/GitTest
import torchvision
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from torchvision.models.detection import FasterRCNN
from torchvision.models.detection.rpn import AnchorGenerator
'''
---------------------------------------------------------------------
Let’s... | 2.296875 | 2 |
asl-api/asl-api/urls.py | ooawagaeri/orbital-asl-application | 2 | 12786493 | <gh_stars>1-10
"""
urls.py
URL Mapping between HTTP and Views
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls import url
from django.views.static import serve
from django.conf.urls.static import static
urlpatterns = [
# Serve Admin ... | 2.203125 | 2 |
python/testData/intentions/PyConvertCollectionLiteralIntentionTest/convertTupleToSetNotAvailableInAssignmentTarget.py | jnthn/intellij-community | 2 | 12786494 | x, <caret>y = 1, 2 | 1.234375 | 1 |
tests/test_utils.py | cnzeki/tensorboardX | 0 | 12786495 | <filename>tests/test_utils.py<gh_stars>0
from tensorboardX import summary
import numpy as np
import pytest
import unittest
from tensorboardX.utils import make_grid, _prepare_video
class UtilsTest(unittest.TestCase):
def test_to_HWC(self):
np.random.seed(1)
test_image = np.random.randint(0, 256, si... | 2.390625 | 2 |
src/nod.py | kirmani/hlpr_cadence | 0 | 12786496 | <filename>src/nod.py
import actionlib
import rospy
from std_msgs.msg import Header
from geometry_msgs.msg import TransformStamped, Transform, Vector3, Quaternion
from hlpr_lookat.msg import LookatWaypointsAction, LookatWaypointsGoal, LookatWaypointsResult
from action import Action
import subprocess
import time
def tr... | 2.328125 | 2 |
cartrade/templates/pages/details_variants.py | vignesharumainayagam/csdwale-cartrade-live | 0 | 12786497 | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Tridots Tech Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
# from _future_ import unicode_literals
import frappe
import frappe.utils
import json
from frappe import _
def g... | 1.695313 | 2 |
src/common/pytorch/layer/normalize_linear_layer.py | wu-uw/OpenCompetition | 15 | 12786498 | import torch
import torch.nn as nn
from torch.nn import Parameter
from torch.autograd import Variable
class NormedLinearLayer(nn.Module):
def __init__(self, input_dim, out_dim, momentum=0.1):
super(NormedLinearLayer, self).__init__()
self.input_dim = input_dim
self.out_dim = out_... | 2.671875 | 3 |
product.py | mbehrle/trytond-sale-available-stock | 0 | 12786499 | <filename>product.py
# -*- coding: utf-8 -*-
"""
product.py
"""
from trytond.pyson import PYSONEncoder, PYSONDecoder
from trytond.modules.stock import ProductByLocation
__all__ = ['ProductByLocationExcludeAssigned']
class ProductByLocationExcludeAssigned(ProductByLocation):
"""
Show Product by Locations... | 2.515625 | 3 |
phr/catalogo/api/serializers.py | richardqa/django-ex | 0 | 12786500 | <reponame>richardqa/django-ex
# coding=utf-8
from rest_framework import serializers
from phr.catalogo.models import (
CatalogoAyudaTecnica, CatalogoCIE, CatalogoDeficiencia, CatalogoDiscapacidad, CatalogoEtnia, CatalogoFinanciador,
CatalogoGradoInstruccion, CatalogoProcedimiento, CatalogoRaza, FamiliaMedicamen... | 2.078125 | 2 |
1131.py | luizgallas/uri_iniciante | 0 | 12786501 | <reponame>luizgallas/uri_iniciante
fim = 1
vgremio = 0
vinter = 0
empate = 0
final = 0
soma = 0
while (fim == 1):
inter, gremio = map(int, input().split())
soma += 1
if inter > gremio:
vinter = vinter + 1
elif gremio > inter:
vgremio = vgremio + 1
elif inter == gremio:
empate... | 3.4375 | 3 |
examples/offline/bc_robo_utils.py | mohanksriram/robolfd | 0 | 12786502 | from dataclasses import dataclass
import h5pickle as h5py
import json
import numpy as np
from numpy import ndarray
from pathlib import Path
from typing import List
import random
from robolfd.types import Transition
import robosuite
from robosuite.utils.mjcf_utils import postprocess_model_xml
import itertools
from tqd... | 2.109375 | 2 |
test/mock_tests/test_markets.py | xelonic-de/iex-data | 2 | 12786503 | <reponame>xelonic-de/iex-data<gh_stars>1-10
from unittest import TestCase
from mock import patch, MagicMock
import iexdata.endpoints.markets as markets
class TestAll(TestCase):
def test_markets(self):
with patch('requests.get') as mock:
mock.return_value = MagicMock()
mock.return_... | 2.203125 | 2 |
scorecardpy/describe.py | cuichaosiig/scorecard_improved | 0 | 12786504 | <filename>scorecardpy/describe.py
import pandas as pd
import numpy as np
def unique_counts(df,cols):
'''
# 显示各个列的唯一值个数:
df: 需要进行处理的dataframe
cols: 需要处理的列
return:
描述信息
-------------------------------
Author: 崔超
'''
uniqC = pd.DataFrame()
uniqC = df.apply(lambda x: len(x.val... | 3.03125 | 3 |
archive/KyleChesney/combine_repeat_ihar.py | ChemiKyle/USING-MACHINE-LEARNING-TO-IMPROVE-POST-ACUTE-REHABILITATION-PROCESS-FLOW | 0 | 12786505 | <filename>archive/KyleChesney/combine_repeat_ihar.py
# We noticed that what should be a unique visit identifier, IHAR, was repeating
# the cause was that patients transferred out or taking leave were listed as being discharged and readmitted
# but they were not assigned a new visit identifier.
# Our solution to clean ... | 2.484375 | 2 |
ASTParser/parser_main.py | DploY707/AST_parser | 4 | 12786506 | from pprint import pprint
import json
import gzip
import pickle
import copy
from androguard.decompiler.dad.decompile import DvMethod
from androguard.misc import AnalyzeAPK
from core.parser import ASTParser
from core.parser import ConstData
from core.parser import stmtList
from core.parser import actionL... | 2.0625 | 2 |
apps/oob/forms/task_forms.py | dbjennings/order-of-business | 0 | 12786507 | from django.forms import ModelForm, Form, CharField
from ..models import Project, Task
class TaskSearchForm(Form):
'''Form for the task search bar'''
query = CharField(max_length=100)
query.widget.attrs.update({'placeholder': 'Search all tasks...',
'class': 'form-control',}... | 2.03125 | 2 |
tests/object/object.py | dem4ply/chibi | 0 | 12786508 | from unittest import TestCase
from chibi.object import Chibi_object
from chibi.object.descriptor import (
String, Dict, Tree_simple, Dict_defaults, Set
)
class Chibi_object_empty( Chibi_object ):
pass
class Chibi_object_with_descriptors( Chibi_object ):
name = String()
test_dict = Dict()
test_d... | 3.21875 | 3 |
txrest/__init__.py | dr4ke616/txREST | 0 | 12786509 | # -*- test-case-name: <INSERT_TEST_MODULE> -*-
# Copyright (c) 2014 <NAME> <<EMAIL>>
# See LICENSE for more details
"""
.. module:: controller
:platform: Linux
:synopsis: Just the __init__.py file
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from txrest.managers.routing import RouteManager
route = RouteManager().... | 1.617188 | 2 |
test/nose_test.py | fakeNetflix/uber-repo-doubles | 150 | 12786510 | <gh_stars>100-1000
import unittest
from nose.plugins import PluginTester
from doubles.nose import NoseIntegration
from doubles.instance_double import InstanceDouble
from doubles.targets.expectation_target import expect
def test_nose_plugin():
class TestNosePlugin(PluginTester, unittest.TestCase):
activa... | 2.421875 | 2 |
ingest/datasets/cifar-10/DataReader.py | ivmfnal/striped | 1 | 12786511 | <gh_stars>1-10
import numpy as np
from BaseDataReader import BaseDataReader
from keras.datasets import cifar10
from keras.utils import to_categorical
class DataReader(BaseDataReader):
def __init__(self, file_path, schema):
(x_train, y_train), _ = cifar10.load_data()
self.x_train = np.asarray(x_train, dtype=np.f... | 2.8125 | 3 |
REGRESSION/Ridge Regression/KERNEL RIDGE/kernelridge.py | algostatml/SUPERVISED-ML | 0 | 12786512 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 11 18:55:01 2019
@author: kenneth
"""
from __future__ import absolute_import
import numpy as np
from Utils.utils import EvalR
from Utils.Loss import loss
from Utils.kernels import Kernels
class kernelridge(EvalR, loss, Kernels):
def __init__(s... | 2.578125 | 3 |
teamleader/__init__.py | rubenvdb/python-teamleader | 0 | 12786513 | <filename>teamleader/__init__.py
__prog__ = 'python-teamleader'
__version__ = u'1.2.1'
| 1.210938 | 1 |
polling_stations/apps/data_importers/management/commands/import_southwark.py | smsmith97/UK-Polling-Stations | 29 | 12786514 | from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "SWK"
addresses_name = "2021-04-13T12:22:55.056323/southwark_deduped.tsv"
stations_name = "2021-04-13T12:22:55.056323/southwark_deduped.tsv"
elections = ["2... | 2.09375 | 2 |
thortils/interactions.py | zkytony/thortils | 0 | 12786515 | def OpenObject(controller, objectId, openness=1.0):
return controller.step(action="OpenObject",
objectId=objectId,
openness=openness)
def CloseObject(controller, objectId):
return controller.step(action="CloseObject",
objectId=obj... | 2.359375 | 2 |
buuctf/136-hwb_2019_mergeheap/exp.py | RoderickChan/ctf_tasks | 0 | 12786516 | #!/usr/bin/python3
from pwncli import *
cli_script()
p:tube = gift['io']
elf:ELF = gift['elf']
libc: ELF = gift['libc']
def add(length:int, data="a\n"):
assert length <= 0x400
p.sendlineafter(">>", "1")
p.sendlineafter("len:", str(length))
p.sendafter("content:", data)
def show(idx):
p.sendlin... | 2.125 | 2 |
src/urllib3/_compat.py | Stanislav1975/urllib3 | 2 | 12786517 | class RLock: # Python 3.6
# We shim out a context manager to be used as a compatibility layer
# if the system `threading` module doesn't have a real `RLock` available.
def __enter__(self) -> None:
pass
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None:
... | 2.53125 | 3 |
leo/modes/lua.py | frakel/leo-editor | 0 | 12786518 | <gh_stars>0
# Leo colorizer control file for lua mode.
# This file is in the public domain.
# Properties for lua mode.
properties = {
"commentEnd": "]]",
"commentStart": "--[[",
"doubleBracketIndent": "true",
"indentCloseBrackets": "}",
"indentOpenBrackets": "{",
"lineComment": "--",
... | 1.554688 | 2 |
test1/noding/noding.py | gr0mph/SpringChallenge2020 | 0 | 12786519 | import sys
sys.path.append('../../')
# Global variables
from test1.test_map import PACMAN_MAP
from test1.test_map import WIDTH
from test1.test_map import HEIGHT
# Class
from Challenge import Case
from Challenge import Node
from Challenge import Edge
from Challenge import BoardNodesAndEdges
# Global
# Method
from Ch... | 2.484375 | 2 |
pygmm/akkar_sandikkaya_bommer_2014.py | nassermarafi/pygmm | 0 | 12786520 | <gh_stars>0
#!/usr/bin/env python3
# encoding: utf-8
from __future__ import division
import collections
import numpy as np
from . import model
__author__ = '<NAME>'
class AkkarSandikkayaBommer2014(model.Model):
"""Akkar, Sandikkaya, & Bommer (2014, :cite:`akkar14`) model.
"""
NAME = '<NAME>, & Bommer... | 2.46875 | 2 |
srd/ei/programs.py | RogerEMO/srd | 1 | 12786521 | <filename>srd/ei/programs.py
from srd import add_params_as_attr
import os
from srd.ei import template
module_dir = os.path.dirname(os.path.dirname(__file__))
# wrapper to pick correct year
def program(year):
"""
Fonction qui permet de sélectionner le programme par année.
Parameters
----------
yea... | 2.65625 | 3 |
Code/BehaviouralModels/DRL.py | Gronne/Individual-Optimization-Based-on-Group-Information-Sharing | 0 | 12786522 | <reponame>Gronne/Individual-Optimization-Based-on-Group-Information-Sharing
import random
import numpy as np
import math
from collections import deque
import time
import os
from tensorflow.keras import models
from tensorflow.keras import layers
from tensorflow.keras import optimizers
from tensorflow.keras import call... | 2.203125 | 2 |
benchmark/config.py | babylonhealth/multiverse | 12 | 12786523 |
MULTIVERSE_NUM_CORES_TO_USE = 1
| 1.023438 | 1 |
preprocess.py | noveens/sampling_cf | 6 | 12786524 | from initial_data_prep_code import movielens, amazon, goodreads, beeradvocate
from data_path_constants import get_data_path
from svp_handler import SVPHandler
percent_sample = [ 20, 40, 60, 80, 90, 99 ]
# Which datasets to prep?
for dataset in [
'magazine',
'ml-100k',
## Did not download & preprocess the followin... | 2.484375 | 2 |
playhouse/sweepea.py | mikiec84/peewee | 1 | 12786525 | <reponame>mikiec84/peewee
"""
Querying using an "ISBL"-like syntax, inspired by
https://github.com/akrito/horrorm
http://www.reddit.com/r/programming/comments/2wycq/given_that_ruby_fans_like_the_idea_of_dsls_its/c2x1t2
Example ISBL:
(t1 * t2) : c1 = v1, c2 = v2 % projection
Swee'pea:
(t1 * t2) ** (c1 == v1, c2 == v2... | 2.84375 | 3 |
clusteris/main/interactor.py | iturricf/clusteris | 0 | 12786526 | # -*- coding: utf-8 -*-
import wx
class Interactor(object):
"""Connects the UI events with the Presenter class."""
def Connect(self, presenter, view):
"""Listens to UI evens and asigns an event handler on the Presenter."""
self.presenter = presenter
self.view = view
# Menu Ar... | 2.421875 | 2 |
app/instance/config.py | Rickyngotho/pitch | 0 | 12786527 | SECRET_KEY = '12345' | 0.957031 | 1 |
web3/utils/functional.py | bellaj/web3py | 0 | 12786528 | <reponame>bellaj/web3py<gh_stars>0
import functools
from eth_utils import (
compose,
)
def apply_formatters_to_return(*formatters):
formatter = compose(*formatters)
def outer(fn):
@functools.wraps(fn)
def inner(*args, **kwargs):
value = fn(*args, **kwargs)
return ... | 2.4375 | 2 |
test/test_delete_group.py | NikolayLukyanov/python_pfqa | 0 | 12786529 | <reponame>NikolayLukyanov/python_pfqa
from model.group import Group
import random
def test_delete_random_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(group_name="zaglushka"))
oldgroups = db.get_group_list()
group = random.choice(oldgroups)
app.group.delete... | 2.96875 | 3 |
wgrib2-v0.1.9.4/pytests/TestModelFile.py | jprules321/colas | 0 | 12786530 | """
Test Basic GrADS Operations on the standard "model" test file.
"""
# Add parent directory to python search path
# ------------------------------------------
import os
import sys
sys.path.insert(0,'..')
sys.path.insert(0,'lib')
import unittest
from grads import GrADS
class TestModelFile(unittest.TestCase):
d... | 2.625 | 3 |
virtual/lib/python3.6/site-packages/category/south_migrations/0001_initial.py | kenmutuma001/galleria | 0 | 12786531 | <reponame>kenmutuma001/galleria<gh_stars>0
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Category'
db.create_table('category_category', ... | 2.25 | 2 |
8kyu/get_the_middle_character.py | nhsz/codewars | 1 | 12786532 | # http://www.codewars.com/kata/56747fd5cb988479af000028/
def get_middle(s):
if len(s) % 2 == 1:
return s[len(s) / 2]
else:
return s[len(s) / 2 - 1 : len(s) / 2 + 1]
| 3.453125 | 3 |
day01.py | Jafnee/advent-of-code-2019 | 0 | 12786533 | def pt1(masses):
return sum(get_fuel(mass) for mass in masses)
def pt2(masses):
return sum(get_fuel_rec(mass) for mass in masses)
def get_fuel(mass: int):
return mass // 3 - 2
def get_fuel_rec(mass):
if (fuel := get_fuel(mass)) <= 0:
return 0
return fuel + get_fuel_rec(fuel)
def test... | 3.546875 | 4 |
folium/plugins/crossfilter.py | BibMartin/folium | 4 | 12786534 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Crossfilter
------
Crossfilter.
"""
from jinja2 import Template
import json
#from .utilities import color_brewer, _parse_size, legend_scaler, _locations_mirror, _locations_tolist, write_png,\
# image_to_url
#from .six import text_type, binary_type
from folium.element imp... | 2.03125 | 2 |
src/order/models.py | xistadi/BookStore | 0 | 12786535 | from django.db import models
from cart import models as cart_models
from django.db.models.signals import post_save
from django.dispatch import receiver
class Order(models.Model):
cart = models.OneToOneField(
cart_models.Cart,
related_name='order',
on_delete=models.PROTECT
)
deliver... | 2.046875 | 2 |
2020/day_22/one.py | zigapk/adventofcode | 0 | 12786536 | from collections import deque
q1 = deque()
q2 = deque()
player_2 = False
with open('in', 'r') as f:
f.readline()
for line in f.readlines():
try:
i = int(line.strip())
if player_2:
q2.append(i)
else:
q1.append(i)
except Except... | 3.0625 | 3 |
tests/test_main/main_weather_data.py | zahraghh/Two-Stage-Stochastic-Programming | 3 | 12786537 | <gh_stars>1-10
import os
import sys
import pandas as pd
import csv
from Two_Stage_SP import download_windsolar_data, GTI,uncertainty_analysis
if __name__ == "__main__":
#Reading the data from the Weather Data Analysis section of the editable_values.csv
editable_data_path =os.path.join(sys.path[0], 'edita... | 2.765625 | 3 |
tests/test_ast.py | keith/xcode-ast-dump | 80 | 12786538 | <gh_stars>10-100
import ast
import unittest
RAW_ARGUMENTS = open("tests/arguments.txt").read().strip().split()
class TestAST(unittest.TestCase):
def test_removes_emits(self):
_, other_arguments = ast.build_parser().parse_known_args(RAW_ARGUMENTS)
for argument in other_arguments:
self.... | 2.75 | 3 |
django_test/articles/migrations/0004_auto_20200306_1921.py | MachineLearningIsEasy/python_lesson_22 | 1 | 12786539 | <gh_stars>1-10
# Generated by Django 3.0.3 on 2020-03-06 19:21
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0003_auto_20200306_1817'),
]
operations = [
migrations.AlterField(
model_name='articl... | 1.617188 | 2 |
tests/python/pants_test/rules/test_run.py | SergeKireev/pants | 0 | 12786540 | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.build_graph.address import Address, BuildFileAddress
from pants.engine.addressable import BuildFileAddresses
from pants.engine.fs import Digest, FileContent, InputFilesContent, ... | 2.0625 | 2 |
supervised/preprocessing/preprocessing_exclude_missing.py | michaelneale/mljar-supervised | 1 | 12786541 | <gh_stars>1-10
import os
import json
import numpy as np
import pandas as pd
import logging
log = logging.getLogger(__name__)
class PreprocessingExcludeMissingValues(object):
@staticmethod
def remove_rows_without_target(data):
if "train" in data:
X_train = data.get("train").get("X")
... | 2.734375 | 3 |
app/stories/admin.py | Sherba/AdventureReader | 0 | 12786542 | <reponame>Sherba/AdventureReader<gh_stars>0
from django.contrib import admin
from .models import Genre, Node, Post
admin.site.register(Genre)
admin.site.register(Node)
admin.site.register(Post)
| 1.210938 | 1 |
main.py | samuelmat19/DDPG-tf2 | 11 | 12786543 | """
Main file
"""
import argparse
import logging
import random
import gym
from tqdm import trange
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from common_definitions import CHECKPOINTS_PATH, TOTAL_EPISODES, TF_LOG_DIR, UNBALANCE_P
from model import Brain
from utils import Tensorboard
... | 2.46875 | 2 |
python/ql/test/experimental/query-tests/Security/CWE-117/LogInjectionGood.py | madhurimamandal/codeql | 4,036 | 12786544 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Desc :Log Injection
"""
from flask import Flask
from flask import request
import logging
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@app.route('/good1')
def good1():
name = request.args.get('name')
name = name.replace('\r\n','').replace... | 2.65625 | 3 |
HW10_K-means/misc.py | 824zzy/CSE-6363_MACHINE-LEARNING | 0 | 12786545 | <filename>HW10_K-means/misc.py<gh_stars>0
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial.distance import cdist
class KMeans(object):
def __init__(self, n_clusters):
self.n_clusters = n_clusters
def fit(self, X, iter_max=100):
all_centers = []
I = np.eye(self.n_cl... | 2.75 | 3 |
24_astro/astro.py | Tjorriemorrie/trading | 2 | 12786546 | import flatlib
from flatlib.chart import Chart
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
def generate_data():
date = Datetime('2015/01/13', '17:00', '+10:00')
print(date)
pos = GeoPos('38n32', '8w54')
print(pos)
chart = Chart(date, pos)
print(chart)
if __name_... | 2.9375 | 3 |
x_rebirth_station_calculator/station_data/wares/v_launcher.py | Phipsz/XRebirthStationCalculator | 1 | 12786547 | <filename>x_rebirth_station_calculator/station_data/wares/v_launcher.py<gh_stars>1-10
from x_rebirth_station_calculator.station_data.station_base import Ware
names = {'L044': 'V Launcher',
'L049': 'V-Starter'}
VLauncher = Ware(names)
| 1.375 | 1 |
modeltranslation_wrapper/models.py | zlorf/django-modeltranslation-wrapper | 1 | 12786548 | <reponame>zlorf/django-modeltranslation-wrapper
from django.conf import settings
try:
from modeltranslation import autodiscover
# direct patch will not be possible.
# one need to set 'modeltranslation_wrapper.patch' at end of MODELTRANSLATION_TRANSLATION_FILES
except ImportError:
# modeltranslation < 0... | 1.492188 | 1 |
setup.py | degibbons/Tilibot | 0 | 12786549 | #!/usr/bin/env python
from distutils.core import setup
setup(name='Tilibot',
version='1.0', # Fix
description='Tiliqua Biomechanics Emulation',
author='<NAME>',
author_email='<EMAIL>',
packages=['distutils', 'distutils.command'], # Fix
) | 1.007813 | 1 |
Lib/site-packages/fidget/backend/Resources.py | fochoao/cpython | 1 | 12786550 | from fidget.backend.QtGui import QIcon
# noinspection PyUnresolvedReferences
import fidget.backend._resources
class LazyIcon:
def __init__(self, path):
self.path = path
self._instance = None
def __call__(self, *args, **kwargs):
if not self._instance:
self._instance = QIcon... | 2.109375 | 2 |