id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
3467324 | <reponame>aivazis/ampcor
# -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
# parasim
# (c) 1998-2021 all rights reserved
#
# pull the action protocol
from ..shells import action
# and the base panel
from ..shells import command
# pull in the command decorator
from .. import foundry
# commands
@foundry(implements=action,... | StarcoderdataPython |
1873136 | <reponame>amcclead7336/Enterprise_Data_Science_Final<filename>venv/lib/python3.8/site-packages/vsts/test/v4_0/models/suite_entry.py<gh_stars>0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the... | StarcoderdataPython |
322006 | <filename>istio/datadog_checks/istio/metrics.py
# (C) Datadog, Inc. 2020 - Present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
GENERIC_METRICS = {
'go_gc_duration_seconds': 'go.gc_duration_seconds',
'go_goroutines': 'go.goroutines',
'go_info': 'go.info',
'go_memstats_al... | StarcoderdataPython |
8169604 | # https://hackernoon.com/gradient-boosting-and-xgboost-90862daa6c77
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.metrics import classification_report
import numpy as np
import matplo... | StarcoderdataPython |
6413789 | <reponame>dave-tucker/hp-sdn-client
#!/usr/bin/env python
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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:/... | StarcoderdataPython |
8093794 | <gh_stars>10-100
# ===============================================================================
# Copyright 2021 ross
#
# 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.... | StarcoderdataPython |
3516081 | <gh_stars>0
class ErrorLog:
def __init__(self, _servername, _timestamp, _type, _msg):
self.servername = _servername
self.timestamp = _timestamp
self.typ = _type
self.msg = _msg
def get_servername(self):
return self.servername
def get_timestamp(self):
... | StarcoderdataPython |
5088990 | import torch
def log_likelihood(nbhd_means, feature_means, feature_vars, k, past_comps = []):
# given neighborhood expression data, construct likelihood function
# should work in pytorch
n_samples = nbhd_means.shape[0]
nbhd_means = torch.tensor(nbhd_means).double()
feature_means = torch.tensor(fe... | StarcoderdataPython |
390346 | from django.urls import path
from . import views as v
app_name = 'core'
urlpatterns = [
path('', v.index, name='index'),
path('form_submit', v.form_submit, name='form_submit'),
path('api/pokemon/<slug:slug>', v.get_pokemon, name='get_pokemon'),
] | StarcoderdataPython |
47806 | # encoding: utf-8
import os
import re
import sys
import gzip
import time
import json
import socket
import random
import weakref
import datetime
import functools
import threading
import collections
import urllib.error
import urllib.parse
import urllib.request
import collections.abc
import json_dict
from . import util... | StarcoderdataPython |
6528648 | <filename>python_examples/util.py
from itertools import islice
import numpy as np
def data_generator(files, batch_size, n_classes):
while 1:
lines = []
for file in files:
with open(file,'r',encoding='utf-8') as f:
header = f.readline() # ignore the header
... | StarcoderdataPython |
1662948 | import re
import random
import requests
import table
import user_agent_list
from bs4 import BeautifulSoup
class HtmlPage:
user_agent_number = 7345
def __init__(self, url):
self.url = url
def get_html(self, creds, proxy_pass):
have_a_try = 3
if not proxy_pass:
... | StarcoderdataPython |
12822 | from django.urls import reverse
from rest_framework import status
from .base import BaseTestCase
class FollowTestCase(BaseTestCase):
"""Testcases for following a user."""
def test_follow_user_post(self):
"""Test start following a user."""
url = reverse('follow', kwargs={'username': 'test2'})
... | StarcoderdataPython |
9676225 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: <NAME>
# Description : FFT Baseline Correction
import sys, os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, SpanSelector
from matplotlib import gridspec
import scipy.fftpack
... | StarcoderdataPython |
3201542 | ##########################################################################
# Geometry data
##
class GeometryData:
""" Class which holds the geometry data of a ObjId
"""
def __init__(self, subdetid = 0, discriminator = ()):
self.subdetid = subdetid
self.discriminator = discriminator
# ObjI... | StarcoderdataPython |
1770434 | from os import path
import sys
sys.path.append(path.join(path.dirname(__file__), path.pardir, path.pardir))
| StarcoderdataPython |
109858 | import pandas as pd
import seaborn as sns
from datetime import datetime
import matplotlib.patches as patches
from ..common import log
from ..util.completion import completion_idx_has_data
def completion_plot(completion, modalities, start, end, freq,
ax=None, cmap=None, x_tick_mult=24, x_tick_fmt="%y-%m-%d %H:%M",... | StarcoderdataPython |
4993721 | <reponame>parsoyaarihant/CS726-Project-2048-Using-RL<gh_stars>0
import random
import logic
import constants as c
class GameGrid():
def __init__(self):
self.commands = {c.KEY_UP: logic.up, c.KEY_DOWN: logic.down,
c.KEY_LEFT: logic.left, c.KEY_RIGHT: logic.right,
... | StarcoderdataPython |
6582731 | <filename>psydac/linalg/tests/test_pcg.py
import numpy as np
import pytest
#===============================================================================
@pytest.mark.parametrize( 'n', [8, 16] )
@pytest.mark.parametrize( 'p', [2, 3] )
def test_pcg(n, p):
"""
Test preconditioned Conjugate Gradient algorithm o... | StarcoderdataPython |
3533318 | from mathlib.math import CustomMath
def test_sum_two_arguments():
first = 2
second = 11
custom_math = CustomMath()
result = custom_math.sum(first,second)
assert result == (first+second)
| StarcoderdataPython |
8000389 | <gh_stars>1-10
"""
Create doc-doc edges
Steps:
1. Load all entities with their relations
2. Load relevant relations
3. Create adjacency matrix for word-word relations
4. Count number of relation between two documents
5. Weight relations and set a doc-doc edge weight
"""
from collections import defaultdict
from math im... | StarcoderdataPython |
9746323 | from django.contrib import admin
from common.actions import make_export_action
from search.models.alias import Alias
from search.models import SuggestionLog
from search.models.session_alias import SessionAlias
class AliasAdmin(admin.ModelAdmin):
list_display = ('id', 'alias', 'target')
actions = make_export_... | StarcoderdataPython |
11299897 | <filename>L1Trigger/L1TCalorimeter/python/hackConditions_cff.py
#
# hachConditions.py Load ES Producers for any conditions not yet in GT...
#
# The intention is that this file should shrink with time as conditions are added to GT.
#
import FWCore.ParameterSet.Config as cms
import sys
from Configuration.Eras.Modifier_... | StarcoderdataPython |
1678043 | <reponame>HSunboy/hue<filename>desktop/core/ext-py/eventlet-0.21.0/eventlet/hubs/poll.py<gh_stars>1-10
import errno
import sys
from eventlet import patcher
select = patcher.original('select')
time = patcher.original('time')
from eventlet.hubs.hub import BaseHub, READ, WRITE, noop
from eventlet.support import get_errn... | StarcoderdataPython |
11263779 | # class Node:
# def __init__(self,value,next= None):
# self.value = value
# self.next = next
# class LinkedList:
# def __init__(self, head= None):
# self.head = head
# def __str__(self):
# current = self.head
# output = ""
# while current is not None:
# ... | StarcoderdataPython |
6521537 | """Generating spectra with Fluctuating Gunn Peterson Approximation (FGPA)
- The code is MPI working on Illustris and MP-Gadget snapshots. The packages needed are :
- astropy
- fake_spectra
To get the FGPA spectra, refer to the helper script at
https://github.com/mahdiqezlou/LyTomo_Watershed/tree/dist/helper... | StarcoderdataPython |
1652657 | from flask import Flask
# from config import Config
app = Flask(__name__)
from application import routes | StarcoderdataPython |
9793758 | <gh_stars>1-10
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from benchmarks import media_router_dialog_metric
from benchmarks import media_router_cpu_memory_metric
from telemetry.page import page_test
... | StarcoderdataPython |
1643201 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os.path
MPATH = "44'/77'/"
WIF_PREFIX = 212 # 212 = d4
MAGIC_BYTE = 30
TESTNET_WIF_PREFIX = 239
TESTNET_MAGIC_BYTE = 139
DEFAULT_PROTOCOL_VERSION = 70913
MINIMUM_FEE = 0.0001 # minimum QMC/kB
starting_width = 933
starting_height = 666
... | StarcoderdataPython |
124186 | from pathlib import Path
import configparser
from logger import logger
def change_config(**options):
"""takes arbitrary keyword arguments and
writes their values into the config"""
# overwrite values
for k, v in options.items():
config.set('root', k, v)
# write back, but without the mand... | StarcoderdataPython |
6501686 | <filename>arachnado/downloadermiddlewares/droprequests.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import warnings
from scrapy.exceptions import IgnoreRequest
class DropRequestsMiddleware:
"""
Downloader middleware to drop a requests if a certain condition is met.
It calls ``spider.... | StarcoderdataPython |
End of preview. Expand in Data Studio
- Downloads last month
- 35