id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
5163122 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 31 19:16:41 2021
@author: dv516
"""
import numpy as np
import pickle
import pyro
pyro.enable_validation(True) # can help with debugging
pyro.set_rng_seed(1)
from algorithms.PyBobyqa_wrapped.Wrapper_for_pybobyqa import PyBobyqaWrapper
from algorithms.Bayesi... | StarcoderdataPython |
1852790 | from typing import Dict, Type, List
import os
import tempfile
import pathlib
import logging
import time
import pandas as pd
from libs.datasets import dataset_base
PICKLE_CACHE_ENV_KEY = "PICKLE_CACHE_DIR"
_EXISTING_CACHE_KEYS = set()
_logger = logging.getLogger(__name__)
def set_pickle_cache_tempdir(force=False)... | StarcoderdataPython |
4899709 | <reponame>zemfrog/zemfrog-test<filename>zemfrog_test/__init__.py
from .command import group
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__version__ = "1.0.3"
command = group
| StarcoderdataPython |
147147 | <reponame>hedrickbt/TigerTag<gh_stars>1-10
import imghdr
import logging
import os
import tempfile
from plexapi.server import PlexServer
from tigertag.scanner import FileInfo
from tigertag.scanner import Scanner
from tigertag.util import calc_hash
logger = logging.getLogger(__name__)
DEFAULT_URL = 'http://127.0.0.1:3... | StarcoderdataPython |
1763129 | <filename>tasks/preprocessing/finetuning.py
# imports
import numpy as np
import pandas as pd
from pathlib import Path
import json
import yaml
from tqdm import tqdm
import pickle
import librosa
import plotext as plt
from IPython.display import display, HTML
import random
import os
import shutil
import torch
from jiwer ... | StarcoderdataPython |
8174045 | from django.shortcuts import render
from .forms import Applicant
# Create your views here.
def profilepage(request):
if request.session['username'] is None:
return render(request, 'jobs/error.html')
profile = Applicant()
if request.method == "POST":
profile = Applicant(request.POST)
... | StarcoderdataPython |
299740 | <reponame>webdevhub42/Lambda
def Rotate(arr):
temp = []
for i in range(len(arr)):
for j in range(0, len(arr)):
if i != j and i < j:
arr[i][j], arr[j][i] = arr[j][i], arr[i][j]
for l in arr:
l.reverse()
print(l)
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
R... | StarcoderdataPython |
8142185 | #! /usr/bin/env python
import os,sys,gc,glob
import re,difflib,time,random,copy
import requests,urllib2,urlparse
from optparse import OptionParser
from bs4 import BeautifulSoup
from HTMLParser import HTMLParser
############ Global setting #############
escaper=HTMLParser()
#disable requests warning
requests.packages.... | StarcoderdataPython |
6659565 | from utility.DBConnectivity import create_connection,create_cursor
def fetch_trans(accno):
try:
list_tra=[]
con=create_connection()
cur=create_cursor(con)
cur.execute('Select B.AccName,T.TDate,T.TType,T.AmtTrans,T.Trans_acc from Transactions T inner join Bank B on T.Trans_acc=B... | StarcoderdataPython |
1655013 | <reponame>nfahlgren/hsi_toolkit_py<gh_stars>10-100
from hsi_toolkit import anomaly_detectors
from hsi_toolkit import classifiers
from hsi_toolkit import endmember_extraction
from hsi_toolkit import signature_detectors
from hsi_toolkit import spectral_indices
from hsi_toolkit import dim_reduction
from hsi_toolkit imp... | StarcoderdataPython |
1744875 | <reponame>AdarshKvT/python-oop
# generalized class
class Pet:
def __init__(self, name, age):
self.name = name
self.age = age
def show(self):
print(f"I am {self.name} and I am {self.age} years old")
def speak(self):
print("I dont no what to say")
# child class inheriting f... | StarcoderdataPython |
4993847 | <filename>old_scripts/hd_regional_stats.py
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 10:17:13 2018
@author: David
"""
# Built-in libraries
#import argparse
#import collections
#import multiprocessing
import os
#import pickle
#import time
# External libraries
#import rasterio
#import gdal
im... | StarcoderdataPython |
9701719 | # Python program to check if given string is an interleaving of the other two strings
# Returns true if C is an interleaving of A and B, otherwise returns false
def is_interleaved(A, B, C):
# Utility variables
i = 0
j = 0
k = 0
# Iterate through all characters of C.
while k != len(C) - 1:
... | StarcoderdataPython |
12800744 | <filename>__init__.py
#!/usr/bin/python
from .rdml import *
name = "rdmlpython"
__all__ = ["rdml"]
| StarcoderdataPython |
200093 | from pm4pymdl import algo, objects, visualization, order_log_generation, util
__version__ = '0.0.45'
__doc__ = "Process Mining for Python - Multi-Dimensional Event Logs"
__author__ = 'PADS'
__author_email__ = '<EMAIL>'
__maintainer__ = 'PADS'
__maintainer_email__ = "<EMAIL>"
| StarcoderdataPython |
176013 | <reponame>bilbeyt/otokon-e_form<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form', '0001_initial'),
]
operations = [
migrations.AlterField(
model... | StarcoderdataPython |
3242679 | <reponame>nkanak/GraphOfDocs
"""
This script contains wrapper functions that
call algorithms in the database,
such as Pagerank, Louvain Community Detection,
and Jaccard Similarity Measure.
Their implementantions are located
in the Neo4j Algorithms library.
"""
def pagerank(database, node, edge, iterations, p... | StarcoderdataPython |
11212667 | from urllib.parse import urlparse, urljoin, urlencode, quote, urlunparse, parse_qsl
from Data.TorrentsUrlProvider import TorrentsUrlProvider
BASE_URL = 'https://kickass.onl/usearch/'
MOST_SEEDERS_QUERY = 'field=seeders&sorder=desc'
def compose_full_url(query) -> str:
search_url_with_query = urljoin(BASE_URL, qu... | StarcoderdataPython |
311185 | import datetime
import os
from flask import abort
from flask_login import current_user
from flask_socketio import disconnect, emit
from home import settings
from home.core.models import get_action, devices
from home.web.models import SecurityEvent, SecurityController
from home.web.utils import send_to_subscribers, ws... | StarcoderdataPython |
3401676 | <gh_stars>10-100
#!/usr/bin/env python
import boto.ec2
import datetime
import os
import time
from fabric.api import cd, env, execute, local, put, run, sudo
from fabric.colors import green as _green, yellow as _yellow
from fabric.context_managers import shell_env
from fabric.contrib.files import exists
from fabric.net... | StarcoderdataPython |
9721404 | from flask_wtf import FlaskForm
from wtforms import PasswordField, EmailField, StringField, DateField, TextAreaField
from wtforms.validators import ValidationError, Optional, InputRequired
from .model import User
from flask_login import current_user
class UpdateCredentials(FlaskForm):
surname = StringField('Surna... | StarcoderdataPython |
8180597 | <filename>library/searchengine/nova3/engines/rarbg.py
#VERSION: 2.10
# AUTHORS: b0nk
# CONTRIBUTORS: <NAME> (<EMAIL>)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain th... | StarcoderdataPython |
5051233 | import numpy as np
import numpy.testing as npt
from dipy.segment.clustering import QuickBundles
from dipy.segment.clusteringspeed import evaluate_aabbb_checks
from dipy.data import get_data
import nibabel as nib
from dipy.tracking.streamline import set_number_of_points
def test_aabb_checks():
A, B, res = evaluate... | StarcoderdataPython |
9672522 | from flask import render_template
from flask_json_schema import JsonValidationError
def json_validation_error(error):
return render_template("validation_error.html", error=error), JsonValidationError | StarcoderdataPython |
6596673 | <gh_stars>1-10
import numpy as np
import cv2
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--cam', type=int, default=0)
parser.add_argument('--hd', action='store_true', help='Save in 720p if possible')
args = parser.parse_args()
cap = cv2.VideoCapture(args.cam)
if args.hd:
cap.set(3, 128... | StarcoderdataPython |
8088071 | # %% Definitions
#
# # The idea here is to
# (see flow_deck_graph in prefect_flows)
#
# 1. Load the previously ETLelled outgoing and incoming graphs
# 2. Build simple paths from card to its entity nodes
# 3. Build a paths df keyed by card_id, entity and orders with some common attributes of these paths:
# paragraph typ... | StarcoderdataPython |
3475686 | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.cache_manager
from frappe.model.document import Document
from frappe.social.doctype.energy_point_... | StarcoderdataPython |
9731702 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import vim
import os
import os.path
from leaderf.utils import *
from leaderf.explorer import *
from leaderf.manager import *
#*****************************************************
# ColorschemeExplorer
#*****************************************************
class Colorsch... | StarcoderdataPython |
160223 | <filename>tests/test_day_12.py
from typing import Tuple
from tests.conftest import day_12
import pytest
@pytest.mark.parametrize('human_instruction,expected_x,expected_y,expected_bearing', [
('F10', 10, 0, 0),
('N3', 0, 3, 0),
('F7', 7, 0, 0),
('R90', 0, 0, 270),
('F11', 11, 0, 0)
])
def test_ex... | StarcoderdataPython |
5047941 | # models
from ..models import Notification
# serializers
from . import IsActiveListSerializer
# rest framework
from rest_framework import serializers
class NotificationSerializer(serializers.ModelSerializer):
class Meta:
list_serializer_class = IsActiveListSerializer
model = Notification
... | StarcoderdataPython |
12835603 | <filename>bike/parsing/load.py
from bike.globals import *
import os
from bike.parsing.fastparser import fastparser
class Cache:
def __init__(self):
self.reset()
def reset(self):
self.srcnodecache = {}
self.typecache = {}
self.maskedlinescache = {}
instance = None
Cache.ins... | StarcoderdataPython |
3360125 | <reponame>augustin-barillec/sonar<gh_stars>0
import math
def dotproduct(v1, v2):
return sum(a*b for a, b in zip(v1, v2))
def length(v):
return math.sqrt(dotproduct(v, v))
def angle_rad(v1, v2):
return math.acos(dotproduct(v1, v2) / (length(v1) * length(v2)))
pi = math.pi
def angle_deg(v1, v2):
... | StarcoderdataPython |
3491548 | # Copyright 2020 ViaSat, 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | StarcoderdataPython |
1775909 | <gh_stars>1-10
#coding: utf-8
''' mbinary
#########################################################################
# File : rabin_karp.py
# Author: mbinary
# Mail: <EMAIL>
# Blog: https://mbinary.xyz
# Github: https://github.com/mbinary
# Created Time: 2018-12-11 00:01
# Description: rabin-karp algorithm
############... | StarcoderdataPython |
8034322 | from __future__ import print_function
import copy
import os
import arrow
import uuid
import json
from flask import current_app
from flask_login import current_user
from sqlalchemy.types import TypeDecorator, CHAR, VARCHAR
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.dialects.sqlite import JSON
from... | StarcoderdataPython |
9769682 | #!/usr/bin/env python3
import os
import json
import sys
import secret
posted_bytes = os.environ.get("CONTENT_LENGTH", 0)
if posted_bytes:
posted = sys.stdin.read(int(posted_bytes))
for line in posted.splitlines():
values = line.split('&')
usr = values[0].split('=')[1]
passw = values[1]... | StarcoderdataPython |
11207897 | <reponame>DanHunt27/Music-Website
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
import re
from django.db.models import Q
from django.shortcuts import get_object_or_404
class Chat(models.Model):
user1 = models.ForeignKey(User, related_name="user_1", on_de... | StarcoderdataPython |
1730032 | <reponame>dhar174/dataset-superscript
import os
import glob
import pandas as pd
import re
import string
from collections import OrderedDict
import io
import csv
from itertools import zip_longest
import matplotlib
from matplotlib import pyplot as plt
import cv2
import time
def yes_or_no(question):
... | StarcoderdataPython |
3496842 | <reponame>VertexC/pipot-server<gh_stars>1-10
import datetime
from flask import Blueprint, g, jsonify, request, render_template_string
from decorators import template_renderer, get_menu_entries
from mod_auth.controllers import login_required, check_access_rights
# Register blueprint
from mod_honeypot.models import Dep... | StarcoderdataPython |
336341 | # -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2019
# (c) University of Strathclyde 2019
# Author: <NAME>
#
# Contact:
# <EMAIL>
#
# <NAME>,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# Cathedral Street,
# Glasgow,
# G1 1XQ
# Scotland,
# UK
#
# The MIT License
#
# Copyright (c) 2016-2019 Th... | StarcoderdataPython |
5084437 | <filename>code/beam_search.py
from APIs import *
from Node import Node
import time
from functools import wraps
# prunning tricks
def dynamic_programming(name, t, orig_sent, sent, tags, mem_str, mem_num, head_str, head_num, label, num=6, debug=False):
must_have = []
must_not_have = []
for k, v in non_trig... | StarcoderdataPython |
3311274 | import pymongo
import dotenv
from .config import MONGO_URI
dotenv.load_dotenv()
client = pymongo.MongoClient(MONGO_URI)
db = client.get_database('cookiecoin') | StarcoderdataPython |
9781968 | <filename>cherrypy/test/test_tools.py
"""Test the various means of instantiating and invoking tools."""
import gzip
import sys
from cherrypy._cpcompat import BytesIO, copyitems, itervalues, IncompleteRead, ntob, ntou, xrange
import time
timeout = 0.2
import types
import cherrypy
from cherrypy import tools
europound... | StarcoderdataPython |
1714376 | <gh_stars>1-10
from datetime import timedelta
from flask import Blueprint, request
from sqlalchemy.exc import IntegrityError
from flask_jwt_extended import create_access_token, create_refresh_token, get_jwt_identity, jwt_refresh_token_required
from http import HTTPStatus
from app.models import User, db
from app.servic... | StarcoderdataPython |
4914024 | <filename>builder/frameworks/linux.py<gh_stars>0
# Copyright 2014-present PlatformIO <<EMAIL>>
#
# 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.... | StarcoderdataPython |
11279873 | <gh_stars>1-10
import torch
import torch.nn as nn
from torchvision import models, transforms
class VGG19(nn.Module):
def __init__(self, vgg_path="models/vgg19-d01eb7cb.pth"):
super(VGG19, self).__init__()
# Load VGG Skeleton, Pretrained Weights
vgg19_features = models.vgg19(pretrain... | StarcoderdataPython |
11387575 | from rest_framework.permissions import BasePermission
class IsOrgAdmin(BasePermission):
"""
Check whether user is org admin.
"""
def has_permission(self, request, *args, **kwargs):
org = request.user.org
if org and org.is_staff:
return True
return False
| StarcoderdataPython |
4934412 | <reponame>KazukiOnodera/Microsoft-Malware-Prediction
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 21:49:53 2019
@author: kazuki.onodera
NOT time series feature
"""
import numpy as np
import pandas as pd
#from multiprocessing import Pool
from sklearn.preprocessing import LabelEncoder
imp... | StarcoderdataPython |
1946166 | from setuptools import setup
setup(name='JSONdb',
version='0.1',
description='A lightweight flat file database Python API using JSON as a storage medium.',
url='https://bitbucket.org/harryjubb/jsondb',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['jsondb']... | StarcoderdataPython |
6647207 | # -*- coding: utf-8 -*-
"""Git client plugin
.. module:: client.plugins.gitclient
:platform: Windows, Unix
:synopsis: Git client
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from hydratk.extensions.client.core import plugin
from hydratk.extensions.client.core.tkimport import tk, ttk, tkfd
from hydratk.extensions.cli... | StarcoderdataPython |
5011158 | <reponame>MxBromelia/SQL-Judge<filename>src/sql_judge/adapter.py
""" Database adapters """
from typing import List, Dict, Tuple
from abc import ABC, abstractmethod
class AbstractAdapter(ABC):
"""
The main and only source for building the schema.
All the methods in this interface are mandatory. If you do no... | StarcoderdataPython |
4985392 | <gh_stars>0
import pytest
import os
import sys
base_path = os.path.join(os.path.abspath(os.path.dirname(__name__)))
sys.path.append(os.path.join(base_path))
from nso_jsonrpc_requester import NsoJsonRpcComet
def test_comet_init_bad_data(request_data_login_get_comet):
test_obj = NsoJsonRpcComet('http', 'example.com... | StarcoderdataPython |
8145108 | <filename>15/15.6/web.py
'''
15-6. Match simple Web domain names that begin with "www." and end with a ".com"
suffix, e.g., www.yahoo.com. Extra credit if your RE also supports other high-level
domain names: .edu, .net, etc., e.g., www.ucsc.edu.
'''
import re
def is_web_domain(text):
m = re.match(r'www\.\w+\.(com... | StarcoderdataPython |
9642419 | from django.contrib import admin
from django.urls import include, path
from django.views.generic.base import TemplateView
urlpatterns = [
path("admin/", admin.site.urls),
path("api/", include("mpact.urls")),
path("login/", TemplateView.as_view(template_name="index.html")),
path("chat/", TemplateView.as... | StarcoderdataPython |
9785854 | <gh_stars>0
from Neurosetta.inputs import swc_input
from Neurosetta.outputs import navis_output, graph_output
class rosettaNEURON:
""" general core class used to move between neuron types """
def __init__(self,neuron):
if isinstance(neuron,str):
self.swcTable = swc_input(neuron)
def ... | StarcoderdataPython |
4945769 | stuff = list()
stuff.append('python')
stuff.append('chuck')
stuff.sort()
print(stuff.__getitem__(0))
print(list.__getitem__(stuff,0))
#dir()函数的输出来查看对象的功能
print(dir(stuff))
# just sample Input >program >Output
usf = input('Enter the US Floor Number: ')
wf = int(usf) - 1
print('Non-US Floor Number is',wf)
| StarcoderdataPython |
3400928 | import os
import django
import sys
import urllib2
import xml.etree.ElementTree as ET
pro_dir = os.getcwd()
sys.path.append(pro_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BioDesigner.settings")
from design.models import parts, features, part_twins, part_features
baseXmlUrl = 'http://parts.igem.org/cgi/xml/... | StarcoderdataPython |
9607135 | <gh_stars>0
# numeros = [2,9,4,11]
# print(numeros[-1])
n = 3
i = 0
while (i < n ):
print(i)
i = i + 1
# for i in range(len(numeros)):
# print(numeros[i])
# n = 4
# for i in range(1,n):
# print(i) | StarcoderdataPython |
249498 | <filename>test/test_election.py
import pytest
from socialchoice import Election, PairwiseBallotBox, RankedChoiceBallotBox
empty_election = Election(PairwiseBallotBox([]))
example_votes = PairwiseBallotBox(
[[0, 1, "win"], [3, 2, "loss"], [2, 3, "win"], [0, 3, "tie"], [3, 0, "win"]]
)
def test_get_ranked_pairs_r... | StarcoderdataPython |
1992151 | <gh_stars>1-10
# coding: utf-8
from __future__ import unicode_literals
from ..compat import (compat_b64decode, compat_urllib_parse_unquote,
compat_urlparse)
from ..utils import determine_ext, update_url_query
from .bokecc import BokeCCBaseIE
class InfoQIE(BokeCCBaseIE):
_VALID_URL = r"http... | StarcoderdataPython |
3291850 | <gh_stars>1-10
from django.db import close_old_connections
from django.dispatch import Signal
consumer_started = Signal(providing_args=["environ"])
consumer_finished = Signal()
# Connect connection closer to consumer finished as well
consumer_finished.connect(close_old_connections)
| StarcoderdataPython |
6438518 | <filename>flow/masked_autoregressive.py
import math
import torch
from torch import nn
import network
class AutoregressiveInverseAndLogProb(nn.Module):
"""Use MADE to build MAF: Masked Autoregressive Flow.
Implements Eqs 2-5 in https://arxiv.org/abs/1705.07057
"""
def __init__(self,
num_i... | StarcoderdataPython |
1812615 | <filename>notebooks/PerfForesightCRRA-Approximation.py<gh_stars>10-100
# ---
# jupyter:
# jupytext:
# cell_metadata_json: true
# formats: py:percent,ipynb
# notebook_metadata_filter: all
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# ju... | StarcoderdataPython |
6594744 | <gh_stars>1-10
import tensorflow as tf
def weight_pruning(w: tf.Variable, k: float) -> tf.Variable:
"""Performs pruning on a weight matrix w in the following way:
- The absolute value of all elements in the weight matrix are computed.
- The indices of the smallest k% elements based on their absolute valu... | StarcoderdataPython |
3267082 | <filename>colossus/apps/subscribers/tests/factories.py
from django.utils import timezone
import factory
from colossus.apps.lists.tests.factories import MailingListFactory
from colossus.apps.subscribers.constants import Status, TemplateKeys
from colossus.apps.subscribers.models import (
Activity, Domain, Subscribe... | StarcoderdataPython |
154770 | from face_detection import face_detect
import os
def createFolder(path, name):
index = ''
while True:
try:
file_path = os.path.join(path, name+index)
os.makedirs(file_path)
return file_path
except:
if index:
index = '('+str(int(ind... | StarcoderdataPython |
11315863 | #!/usr/bin/python
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "0.1.0",
"status": ["preview"],
"supported_by": "community",
}
DOCUMENTATION = r"""
---
module: launchdarkly_feature_flag_validator
short_description: Validate... | StarcoderdataPython |
386027 | # Copyright 2020 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, d... | StarcoderdataPython |
264861 | #
# =====================
# Training a Classifier
# =====================
#
import time, os, copy, numpy as np
import torch, torchvision
import torch.nn as nn
from torch.nn import Parameter, init
import torch.nn.functional as F
import torch.optim as optim
from torch.optim import lr_scheduler
import torchvision.dat... | StarcoderdataPython |
3325554 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from .Utility import deep_update
from .JsonAccessor.JsonAccessor import load_json
class ConfigureLoader(object):
CONFIG_FILENAME_DEFAULT = "ConfigDefault.json"
CONFIG_FILENAME_USER = "ConfigUser.json"
@staticmethod
def load_file(dir... | StarcoderdataPython |
9705028 | # Generated by Django 3.2.10 on 2022-01-09 17:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0018_ProductGroups'),
]
operations = [
migrations.AddField(
model_name='course',
name='display_in_lms',... | StarcoderdataPython |
9612050 | from dataclasses import dataclass
from enum import Enum
from typing import List, Union, Dict
from brain_brew.configuration.part_holder import PartHolder
from brain_brew.configuration.representation_base import RepresentationBase
from brain_brew.interfaces.yamale_verifyable import YamlRepr
from brain_brew.representatio... | StarcoderdataPython |
11275953 | <filename>app/scienceapi/events/migrations/0003_auto_20160425_1752.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-25 17:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | StarcoderdataPython |
1997754 | <filename>alpha_vantage/functions/__init__.py<gh_stars>0
from alpha_vantage.functions.timeseries import TimeSeries | StarcoderdataPython |
12847985 | <reponame>medfiras/Bazinga
from userena.forms import EditProfileForm
from userena import views as userena_views
class CustomEditProfileForm(userena_views.EditProfileForm):
class Meta(EditProfileForm.Meta):
exclude = EditProfileForm.Meta.exclude + ['privacy'] | StarcoderdataPython |
3308691 | <reponame>SpeagleYao/IP_Final_Project<gh_stars>0
from img_aug import data_generator
from models import *
from loss import *
import numpy as np
import cv2
import torch
model = CENet_My()
model.load_state_dict(torch.load('./pth/CENet_My.pth'))
model.eval()
criterion = DiceLoss()
g_val = data_generator('./data/img_val.n... | StarcoderdataPython |
1935354 | # coding: utf-8
#
# Weather station display for Raspberry and Waveshare 2.7" e-Paper display
# (fetch ThingSpeak data)
#
# Copyright by <NAME>
#
# Documentation and full source code:
# https://github.com/arutz12/Raspberry-Weather-EPD
#
import os
import requests
import json
from dotenv import load_dotenv
base_dir = os... | StarcoderdataPython |
3534724 | <filename>classcharts_trello_sync/__init__.py
from .generate_config import configure
from .sync import sync_data
__all__ = (
'configure',
'sync_data',
)
| StarcoderdataPython |
290834 | """
Program written by <NAME>?
MAR/2020 during confinement
"""
import os
import json
import config
from urllib import request
def jsonparsser(location):
"""
go get the data, make the first parssing and return the data
"""
try:
toreturn = json.load(request.urlopen\
("https://www.franceix.net... | StarcoderdataPython |
6504073 | import numpy as np
from time import time
from math import sqrt, pow
#Get list of active taxels per bounding box on the image, create an array of the taxel center
def bb_active_taxel (bb_number, T, bb_predictions_reshaped, TIB, skin_faces):
taxel_predictions, pixel_positions,taxel_predictions_info = np.empty((bb_num... | StarcoderdataPython |
6443410 | <filename>qiskit/algorithms/phase_estimators/phase_estimator.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.... | StarcoderdataPython |
5095709 | # Generated by Django 2.0.6 on 2018-06-05 09:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id... | StarcoderdataPython |
12850004 | from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.contrib import messages
from django.shortcuts import render_to_response, get_object_or_404
from django.template impo... | StarcoderdataPython |
3260942 | import stocklab
stocklab.bundle(__file__)
| StarcoderdataPython |
3399331 | from abc import ABC
from flask import Blueprint
from flask import url_for
from Config import Config
class AbstractService(ABC):
def __init__(self):
self.serviceName = type(self).__name__.lower()
self.blueprint = Blueprint(self.serviceName, self.serviceName)
| StarcoderdataPython |
5131991 | <filename>celerytask/tasks.py
# encoding:utf-8
from celery import Celery
import os
import time
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'osf.settings')
#os.environ['CELERY_CONFIG_MODULE'] = 'celerytask.celeryconfig'
app = Celery('test')
# Using a string here means the worker wil... | StarcoderdataPython |
11229755 | from airtravel import *
from pprint import pprint as pp
f = Flight("BA777", Aircraft("G-EUPT", "Airbus A312", num_rows=22, num_seats_per_row=6))
print(f.aircraft_model())
f = Flight("BA758", Aircraft("G-RUPT", "Airbus A319", num_rows=22, num_seats_per_row=6))
# pp(f.seating) # all seats free
f.allocate_seat("12A",... | StarcoderdataPython |
8196242 | import typing
import unittest
class SnakeTestCase(unittest.TestCase):
def test_snake(self):
from core import Snake, Action
key2direction: typing.Dict[str, int] = {
'w': Action.UP,
's': Action.DOWN,
'a': Action.LEFT,
'd': Action.RIGHT
}
... | StarcoderdataPython |
11387644 | <filename>tests/mocks/mocked_redis.py
from typing import Dict, Optional
class MockedRedis:
"""A mock aioredis.Redis class that
imitates the required methods.
"""
def __init__(self):
self._data: Dict[str, dict] = {}
@property
def cache(self) -> Dict:
return self._data
asy... | StarcoderdataPython |
255579 | <filename>hubblestack/utils/__init__.py
# coding: utf-8
from hubblestack.utils.process import daemonize
| StarcoderdataPython |
11274490 | import autograd.numpy as np
from autograd import grad
from autograd import jacobian
from src.maths.func_stats import *
class Prior(object):
def single(self,theta):
"""univariate probability distribution function"""
return NotImplemented
def prior(self, theta):
"""likelihood"""
... | StarcoderdataPython |
4802999 | from copy import deepcopy
from IPython.nbconvert.preprocessors import Preprocessor
from IPython.utils.traitlets import Unicode
class CherryPickingPreprocessor(Preprocessor):
expression = Unicode('True', config=True, help="Cell tag expression.")
def preprocess(self, nb, resources):
# Loop through eac... | StarcoderdataPython |
9678815 | <reponame>alphagov/sandbox-mgt
import os
import base64
from django.conf import settings
from django.http import HttpResponse
def basic_challenge(realm='Restricted Access'):
response = HttpResponse('Authorization Required')
response['WWW-Authenticate'] = 'Basic realm="%s"' % (realm)
response.status_code =... | StarcoderdataPython |
1907023 | def assignment(a: bool, b: str, c: int, d: int) -> int:
e = a
f = b
g = c
h = c + d
j = k = l = c + d + g + h
return j + k + l if a and e or f == "hello" else 0
def annotated_assignment(a: bool, b: str, c: int, d: int) -> int:
e: int = 3
f: bool = a
g: str = b
h: int = c + d
... | StarcoderdataPython |
3510479 | """General interface for a planner.
"""
import abc
import numpy as np
class Planner:
"""An abstract planner for PDDLGym.
"""
def __init__(self):
self._statistics = {}
@abc.abstractmethod
def __call__(self, domain, state, horizon=np.inf, timeout=10,
return_files=False, tr... | StarcoderdataPython |
29246 | <filename>Libs/Scene Recognition/SceneRecognitionCNN.py
import torch.nn as nn
from torchvision.models import resnet
class SceneRecognitionCNN(nn.Module):
"""
Generate Model Architecture
"""
def __init__(self, arch, scene_classes=1055):
super(SceneRecognitionCNN, self).__init__()
# --... | StarcoderdataPython |
12807355 | <gh_stars>1-10
# Generated by Django 2.0.6 on 2018-07-04 02:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Subject',
f... | StarcoderdataPython |
86618 | <filename>exec/bnc.py
import json
import os
from pyconversations.reader import BNCReader
if __name__ == '__main__':
data_root = '/Users/hsh28/data/'
out = data_root + 'conversations/'
os.makedirs(out + 'Reddit/BNC/', exist_ok=True)
convos = BNCReader.read(data_root + 'BNC/*', ld=True)
cache = []... | StarcoderdataPython |
3230377 | <reponame>flo-compbio/monet
# Copyright (c) 2021 <NAME>
#
# This file is part of Monet.
from .nonlinear import *
from .clustering import *
from .denoising import *
from .heatmap import *
from .preprocess import *
from .scvelo import *
| StarcoderdataPython |
285303 | <reponame>hbasria/netbox-dns<gh_stars>0
from django.urls import reverse
from utilities.testing import APITestCase
from netbox_dns.models import NameServer, Record, Zone
class ZoneAPITestCase(APITestCase):
"""
Tests for Zone API (format=json)
"""
def test_view_zone_without_permission(self):
ur... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.