id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
142986 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | StarcoderdataPython |
1667672 | <reponame>Gerryflap/master_thesis
"""
Uses the pairs defined by data/split_generation/pair_generator.py output pairs of images in the following format:
((morph_inputs, comparison_images), (id_1, id_2))
where both morph_inputs and comparison_images are tuples of images of (person_1, person_2).
"""
import ran... | StarcoderdataPython |
55166 | <filename>dashboard/__init__.py
from flask import Flask
app = Flask(__name__)
app.config['SECRET_KEY'] = 'fac5f35dc32ba113029dad3eb831d7d1'
from dashboard import routes | StarcoderdataPython |
150404 | <filename>data_sets/synthetic_review_prediction/article_0/__init__.py<gh_stars>1-10
from .configure import DATASET_NAME, create_data_set_properties
from .generate import run as _run
def run(client):
print(DATASET_NAME)
return _run(client, create_data_set_properties())
| StarcoderdataPython |
3252816 | <filename>client/ui.py
# Interface for registration
# Written by: <NAME>, <NAME>, <NAME>, and <NAME>
# Written for: Instant messenger project
# Created on: 4/10/2016
from client import rpc
from tkinter import *
from tkinter import messagebox
from tkinter.ttk import *
import queue
# Set up a global incomi... | StarcoderdataPython |
3349246 | from . import db
| StarcoderdataPython |
1772025 | <filename>pyfileconf/plugin/impl.py
import pluggy
hookimpl = pluggy.HookimplMarker('pyfileconf') | StarcoderdataPython |
3305099 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.ops.argmin import ArgMinOp
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.front.tf.extractors.utils import tf_dtype_extractor
class ArgMinFrontExtractor(... | StarcoderdataPython |
1774223 | <reponame>Luke-Ludwig/DRAGONS<filename>geminidr/gmos/tests/spect/test_determine_distortion.py
#!/usr/bin/env python
"""
Tests related to GMOS Long-slit Spectroscopy Arc primitives.
Notes
-----
- The `indirect` argument on `@pytest.mark.parametrize` fixture forces the
`ad` and `ad_ref` fixtures to be called and the A... | StarcoderdataPython |
149676 | import pathlib
from collections import namedtuple
from PIL import Image
import warnings
Image.MAX_IMAGE_PIXELS = 100000000000
class Slide:
'''
A slide object
'''
def __init__(self, path, img_requirements=None, stain_type='Unknown'):
'''
Creates a slide object with all possible data ... | StarcoderdataPython |
1660783 | from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.fields.simple import TextAreaField
from wtforms.validators import DataRequired, Email, ValidationError, Length, EqualTo
from wtforms import StringField, PasswordField... | StarcoderdataPython |
1750050 | import os
import time
import subprocess
import signal
from .Testcase import Testcase
def execute(case: Testcase, judge_conf: dict,str_cmd:str) -> (int, str): # (elapsed, kses)
tmp_path = judge_conf["tmp_path"]
if not os.path.exists(tmp_path):
os.system(f"mkdir {tmp_path}")
try:
in_path =... | StarcoderdataPython |
90296 | <reponame>anglebinbin/Barista-tool
'''
Created on 08.11.2016
@author: k.hartz
'''
import os
import time
import sys
# Logfile to pass through stdout
logFile = "test/logfiles/test_log_1.log"
# delay per line in sec, 1=1sec
delayPerLine = 0.01
# Seperator to seperate the logfile output from print
seperator = "-------... | StarcoderdataPython |
1616733 | <filename>samples/python/houghcircles.py
#!/usr/bin/python
'''
This example illustrates how to use cv.HoughCircles() function.
Usage:
houghcircles.py [<image_name>]
image argument defaults to board.jpg
'''
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2 as cv
... | StarcoderdataPython |
57203 | <gh_stars>0
class Edge:
def __init__(self, start, end):
self.start = start
self.end = end
def __str__(self):
return "<" + str(self.start) + " " + str(self.end) + ">"
| StarcoderdataPython |
128338 | <gh_stars>1-10
"""
``permute`` provides permutation tests and confidence intervals for a variety
of nonparametric testing and estimation problems, for a variety of
randomization designs.
* Stratified and unstratified tests
* Test statistics in each stratum
* Methods of combining tests across strata
* Nonparametric com... | StarcoderdataPython |
44029 | import ipaddress
from collections import defaultdict
from autonetkit.design.utils import filters
from autonetkit.design.utils.general import group_by
from autonetkit.network_model.types import LAYER3_DEVICES
def assign_loopbacks(topology):
"""
@param topology:
"""
layer3_nodes = [n for n in topology... | StarcoderdataPython |
1603702 | import os
from flask import redirect, url_for, render_template, request, jsonify, abort
from .Room import Room
from .Permissions import Permissions
from .Task import Task
from .Token import Token
from .Layout import Layout
from . import main
from .forms import LoginForm, TokenGenerationForm
from .User import User
fro... | StarcoderdataPython |
152214 | <filename>core/iam_utils.py
import boto3
import json
import random
def generate_policy_prefix(user_group_name):
'''policy prefix for user group'''
# add rangom tag to avoid attempting to overwrite a previously created and deleted policy and silently failing.
random_tag = str(int(random.random() * 10000))
... | StarcoderdataPython |
1771750 | <reponame>javierlorenzod/HigherHRNet-Human-Pose-Estimation
from torch.utils.data import Dataset, DataLoader
import torch
from PIL import Image
import glob
import os.path as osp
import os
import random
"""
Posibles mejoras:
- Comprobar image format es válido --> buscar en internet
- Comprobar parámetros de entrada
- ge... | StarcoderdataPython |
3242123 | <gh_stars>0
import sys
import pandas as pd
if __name__ == "__main__":
path = sys.argv[1]
ser = pd.read_csv(path, header=None).squeeze()
ser = ser.rolling(3).sum()
print((ser > ser.shift(1)).sum())
| StarcoderdataPython |
1644909 | """Internal representation of network name"""
from typing import List, Union
import binascii
import json
import os
from typing import List, Union
class Name(object):
"""
Internal representation of network name
"""
def __init__(self, name: Union[str, List[bytes]] = None, suite='ndn2013'):
se... | StarcoderdataPython |
1762325 | <reponame>hikaru-sysu/taichi<gh_stars>0
from taichi.lang.simt import warp
__all__ = ['warp']
| StarcoderdataPython |
3261587 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.image_classification.abstract import ImageClassifier
from models.nn_utils import conv_layer, fc_layer
class ResBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1):
sup... | StarcoderdataPython |
3351975 | <reponame>uri-yanover/sharik
from setuptools import setup, find_packages
setup(
name="sharik",
version="0.4.1",
packages=find_packages(),
description='A shar(1)-like utility with a programmatic fine-tuned API',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/uri-yanover/sha... | StarcoderdataPython |
73081 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2020-11-10 08:06
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
import django.db.models.deletion
import sentry.db.models.fields.foreignkey
class Migration(migrations.Migration):
dependencies = [
... | StarcoderdataPython |
96999 | <reponame>cclauss/CommunityCellularManager<filename>smspdu/smspdu/__main__.py
#!/usr/bin/env python3
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of p... | StarcoderdataPython |
1782244 | """Test that various serving options work"""
import json
import subprocess
import time
import pytest
from tornado import httpclient
from .conftest import CI, DARWIN, LINUX, PYPY
if CI and DARWIN: # pragma: no cover
pytest.skip("skipping flaky MacOS tests", allow_module_level=True)
if CI and LINUX and PYPY: #... | StarcoderdataPython |
3348287 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import enum
from pyuvm import *
import random
@enum.unique
class Ops(enum.IntEnum):
"""Legal ops for the TinyALU"""
ADD = 1
AND = 2
XOR = 3
MUL = 4
class PythonProxy(uvm_component):
@staticmethod
def alu_op(A, B, op):
result = None... | StarcoderdataPython |
3358035 | import logging
import os
import time
from flask import Flask, request, jsonify
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from deeppavlov import build_model
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
logger = logging.getLogg... | StarcoderdataPython |
3366507 | <reponame>jwestraadt/GrainSizeTools
# ============================================================================ #
# #
# This is part of the "GrainSizeTools Script" #
# A Python script for characterizing g... | StarcoderdataPython |
1785702 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-07-01 02:55
from __future__ import unicode_literals
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bruv', '0004_auto_20160... | StarcoderdataPython |
1670868 | <filename>src/githyperlink/cli.py
import sys
import subprocess
from click import command, argument
from .main import get_hyperlink
@command()
@argument("path", required=False)
def get_and_print_hyperlink(path=None):
if path is None:
path = "."
try:
url = get_hyperlink(path)
except subproces... | StarcoderdataPython |
67345 | <filename>test_crf_layer.py
# 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 ... | StarcoderdataPython |
120642 | """Support for showing the time in a different time zone."""
from __future__ import annotations
from datetime import tzinfo
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_NAME, CONF_TIME_ZONE
from homeassistant.core import HomeA... | StarcoderdataPython |
71872 | # coding=utf-8
from .abstract import ContactActionAbstract
from .contants import *
from .create import ContactCreateAction
from .delete import ContactDeleteAction
from .read import ContactReadAction
from .update import ContactUpdateAction
from .write import ContactWriteAction
| StarcoderdataPython |
1630990 | <reponame>thejohnfreeman/picard
"""Picard combines the idea of Ansible with the execution of Make."""
# I'm only slightly worried about the rebindings of ``file`` and ``rule``...
from picard.api import make, sync
from picard.context import Context
from picard.file import (
FileRecipePostConditionError, FileTarget,... | StarcoderdataPython |
3398110 | import argparse
import os
import os.path as osp
from shutil import copyfile
import mmcv
from tqdm import tqdm
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--annotation_path", default="/data/coco_train.json")
parser.add_argument("--image_root", default="/data/train")
parse... | StarcoderdataPython |
173984 | from django.db import models
# Create your models here.
class Stocks(models.Model):
ticker = models.CharField(max_length=5, default='STOCK',)
date = models.DateField()
open = models.IntegerField()
high = models.IntegerField()
low = models.IntegerField()
close = models.IntegerField()
volume... | StarcoderdataPython |
4814575 | <reponame>slp-ntua/slp-labs<filename>lab2/dnn/torch_dataset.py
import os
import kaldi_io
import numpy as np
from torch.utils.data import Dataset
class TorchSpeechDataset(Dataset):
def __init__(self, recipe_dir, ali_dir, dset, feature_context=2):
self.recipe_dir = recipe_dir
self.ali_dir = ali_dir... | StarcoderdataPython |
142321 | <filename>recipes/xkbcommon/all/conanfile.py<gh_stars>0
from conans import ConanFile, Meson, tools
from conans.errors import ConanInvalidConfiguration
import os
class XkbcommonConan(ConanFile):
name = "xkbcommon"
description = "keymap handling library for toolkits and window systems"
topics = ("conan", "x... | StarcoderdataPython |
3286827 | <gh_stars>0
from credstuffer.proxy.grabber import ProxyGrabber
from credstuffer.proxy.provider import ProxyProvider
| StarcoderdataPython |
23872 | #!/usr/bin/env python
import random
import argparse
def generate_passwords(password_file_path):
password_file = open(password_file_path, 'w')
chars = 'abcdefghijklmnopqrstuvxyz01234567890_-!*'
secret_key = ''.join(random.SystemRandom().choice(chars) for _ in range(50))
password_file.write("SECRET_KEY ... | StarcoderdataPython |
1642064 | from .revenues import Revenues
import pandas as pd
class ForwardPlanning:
def __init__(self, worksite):
"""Gestion prévisionnelle ( à la fin de la synthèse chantier )."""
self.worksite = worksite
for name in worksite.category_names:
if name != "PRODUITS" and name != "DIVERS":
... | StarcoderdataPython |
1680200 | <filename>setup.py
from distutils.core import setup
setup(
name='wallet-utils',
version='0.0.0',
packages=['wallet_utils'],
url='',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='Utilities for dealing with crypto wallets (support for HD wallets). Makes use of the e... | StarcoderdataPython |
3233294 | <reponame>sandeep-krishna/100DaysOfCode
'''
Life the universe and Everything
Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output.
Stop processing input after reading in the number 42.
All numb... | StarcoderdataPython |
1649651 | # This scrip starts the salt-master service and the salt-minion service
# For each device it starts a salt-proxy daemon
import os
import yaml
print ('starting salt master')
os.system('docker exec -it salt service salt-master restart')
print ('starting salt minion')
os.system('docker exec -it salt service salt-minio... | StarcoderdataPython |
1648031 | # Copyright (c) 2019 <NAME>
import numpy as np
from PokerRL.cfr._CFRBase import CFRBase as _CFRBase
class CFRPlus(_CFRBase):
def __init__(self,
name,
chief_handle,
game_cls,
agent_bet_set,
other_agent_bet_set=None,
... | StarcoderdataPython |
3266211 | <filename>tests/test_bump_create_commit_message.py<gh_stars>10-100
import sys
from pathlib import Path
from textwrap import dedent
import pytest
from packaging.version import Version
from commitizen import bump, cli, cmd, exceptions
conversion = [
(
("1.2.3", "1.3.0", "bump: $current_version -> $new_vers... | StarcoderdataPython |
1671516 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
More or less a python port of Stewart method from R SpatialPositon package
(https://github.com/Groupe-ElementR/SpatialPosition/).
@author: mthh
"""
import numpy as np
from matplotlib.pyplot import contourf
from shapely import speedups
from shapely.ops import unary_unio... | StarcoderdataPython |
7770 | <reponame>mederrata/probability
# Copyright 2021 The TensorFlow Probability 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
#
# Unl... | StarcoderdataPython |
130125 | #!/usr/bin/env python3
from collections import OrderedDict
import re
import sys
try:
filename = sys.argv[1]
if '.' not in sys.argv[2]:
raise ValueError
except:
print('Usage: python3 {} filename (entity_id [attribute...])...'.format(sys.argv[0]))
sys.exit(1)
attrs = {}
entity_id = None
for ar... | StarcoderdataPython |
1739474 | <reponame>black-shadows/LeetCode-Solutions<filename>Python/convex-polygon.py
# Time: O(n)
# Space: O(1)
class Solution(object):
def isConvex(self, points):
"""
:type points: List[List[int]]
:rtype: bool
"""
def det(A):
return A[0][0]*A[1][1] - A[0][1]*... | StarcoderdataPython |
1720290 | <reponame>saxobroko/node-launcher
from unittest.mock import MagicMock
from tempfile import NamedTemporaryFile
import pytest
from node_launcher.gui.menu.nodes_manage.manage_dialogs.configuration import ConfigurationDialog
from node_launcher.node_set.lib.configuration import Configuration
from node_launcher.node_set.li... | StarcoderdataPython |
62961 | from twisted.internet import defer
import config
import log
from color import colorize
from err import *
class Scanner(object):
def __init__(self, target, checks, title=None, verbose=False, runningResults=False):
self.target = target
self.checks = checks
self.title = title
self.sc... | StarcoderdataPython |
29248 | import rv.api
class Command(object):
args = ()
processed = False
def __init__(self, *args, **kw):
self._apply_args(*args, **kw)
def __repr__(self):
attrs = ' '.join(
'{}={!r}'.format(
arg,
getattr(self, arg),
)
for ... | StarcoderdataPython |
4803319 | from __future__ import absolute_import
from version_information.version import version as __version__
from version_information.version_information import *
| StarcoderdataPython |
3321969 | # -*- coding: UTF-8 -*-
#
from os import environ
DEBUG = True
YDB_ENDPOINT = environ.get("YDB_ENDPOINT")
YDB_DATABASE = environ.get("YDB_DATABASE", "")
YDB_PATH = environ.get("YDB_PATH", "")
YDB_TOKEN = environ.get("YDB_TOKEN")
| StarcoderdataPython |
4817660 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import pandas as pd
import numpy as np
#import matplotlib.pyplot as plt
#from pylab import rcParams
#import matplotlib
from sklearn.model_selection import train_test_split
from sklearn.prepro... | StarcoderdataPython |
4824472 | import gym
import numpy as np
from gym.envs import register
from joblib import Parallel, delayed
import pickle
import matplotlib.pyplot as plt
from q_learning import Qlearning
from tile_coding_action_value_function import TileCodingActionValueFunction
from true_online_sarsa_lambda import TrueOnlineSarsaLambda
register... | StarcoderdataPython |
43131 | import json
from service.tests.functional import MonitoringTestCase
class TestAlarm(MonitoringTestCase):
ENDPOINT = '/nbi/monitoring/api/alarms/'
def test_get_alarms(self):
"""
Test that validates getting all alarms
It asserts the response code 200, the default alarm limit 5 and the ... | StarcoderdataPython |
1678274 | <filename>src/pymor/operators/interfaces.py
# -*- coding: utf-8 -*-
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: <NAME>, <NAME>, <NAME>
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function... | StarcoderdataPython |
1634399 | from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
class WxUserTokenObtainPairSerializer(TokenObtainPairSerializer):
@classmethod
def get_token(cls, user):
token = super().get_token(user)
token['openid'] = user.openid
token['unionid'] = user.unionid
retur... | StarcoderdataPython |
165659 | # -*- coding: utf-8 -*-
###
# © 2018 The Board of Trustees of the Leland Stanford Junior University
# <NAME>
# <EMAIL>
###
"""
The official Python client for Pulsar LIMS.
Required Environment Variables:
1) PULSAR_API_URL
2) PULSAR_TOKEN
"""
import logging
import os
import sys
from urllib.parse import urlpar... | StarcoderdataPython |
4828435 | """Build extension to generate immutable JavaScript protocol buffers.
Usage:
immutable_js_proto_library: generates a immutable JavaScript implementation
for an existing proto_library.
Example usage:
proto_library(
name = "foo",
srcs = ["foo.proto"],
)
immutable_js_proto_li... | StarcoderdataPython |
3261491 | from nose.tools import assert_equal
from pyecharts.charts import Line
def test_chart_append_color():
x_data = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
y_data1 = [140, 232, 101, 264, 90, 340, 250]
y_data2 = [120, 282, 111, 234, 220, 340, 310]
c = (
Line()
.add_xaxis(xaxis_data=x_... | StarcoderdataPython |
1789456 | from typing import Any, List
import networkx as nx
from interface import Interface, implements
from .builders.graph_builders import GraphBuilderInterface, TextGCNGraphBuilder
from .model.document import Document
from .model.graph_matrix import GraphMatrix
from .nlp.pieplines import ProcessingPipeline, ProcessingPipel... | StarcoderdataPython |
3256796 | '''
altimu10v5: Main module
Copyright 2017, <NAME>
Licensed under MIT.
'''
from .lsm6ds33 import LSM6DS33
from .lis3mdl import LIS3MDL
from .lps25h import LPS25H
class IMU(object):
""" Set up and control Pololu's AltIMU-10v5.
"""
def __init__(self):
super(IMU, self).__init__()
self.lsm6d... | StarcoderdataPython |
50761 | <reponame>DCCouncil/dc-law-tools<filename>build_xml/insert_tables.py
"""
The Lexis parser does not parse tables, so this script
inserts manually-created html tables defined in tables.xml.
tables.xml *must be* updated when a new version of the code
comes out.
"""
import os.path
import lxml.etree as etree, re
DIR = os.... | StarcoderdataPython |
1617858 | <filename>examples/diff_gpmp2_nonholonomic_example.py
#!/usr/bin/env python
import os, sys
sys.path.insert(0, "..")
import matplotlib.pyplot as plt
import numpy as np
import pprint
import time
import torch
from diff_gpmp2.env.env_2d import Env2D
from diff_gpmp2.robot_models import PointRobotXYH
from diff_gpmp2.gpmp2.di... | StarcoderdataPython |
3255757 | <reponame>kchida/aptly
"""
Testing DB operations
"""
from .cleanup import *
from .recover import *
| StarcoderdataPython |
3389876 | <filename>prolink/api/urls.py
from django.conf.urls import url
from rest_framework import routers
from prolink.api import views
router = routers.DefaultRouter()
urlpatterns = [
url(r'drawer/self/', views.DrawerTransactionsViewSet.as_view(), name='drawer-self'),
url(r'drawer/view-user/', views.UserDrawerViews... | StarcoderdataPython |
17658 | """
The key is to use a set to remember if we seen the node or not.
Next, think about how we are going to *remove* the duplicate node?
The answer is to simply link the previous node to the next node.
So we need to keep a pointer `prev` on the previous node as we iterate the linked list.
So, the solution.
Create a set ... | StarcoderdataPython |
1729704 | <gh_stars>0
# Auto generated by generator.py. Delete this line if you make modification.
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
XPATH = {
'name' : "//form[@id='aspnetForm']/div[@id='lg-wrapper']/div[@class='lg-info-prd-details']/h1",
'price' : "//div[@class='lg-box-pric... | StarcoderdataPython |
4843054 | import os
import json
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render
from logtailer.models import LogsClipboard, LogFile
from django.utils.translation import ugettext as _
from django.views.decorators.csrf import csrf_exempt
from django.contrib.admin.... | StarcoderdataPython |
59038 | <gh_stars>0
"""
Use zip to transpose data from a 4-by-3 matrix to a 3-by-4 matrix. There's actually a cool trick for this! Feel free to look at the solutions if you can't figure it out.
"""
data = ((0, 1, 2), (3, 4, 5), (6, 7, 8), (9, 10, 11))
# 0 1 2
# 3 4 5
# 6 7 8
# 9 10 11
#
# Transpose : [data]^T
#
# 0 3 ... | StarcoderdataPython |
3344677 | <gh_stars>1-10
"""
Analysis functions
"""
# Copyright (c) <NAME>
# Distributed under the terms of the MIT License
# author: <NAME>
import numpy as np
from scipy import integrate
from scipy.constants import codata
kb = codata.value('Boltzmann constant')
ev = codata.value('electron volt')
ev = -ev
class OneDimension... | StarcoderdataPython |
3230886 | """This problem was asked by Google.
Given an undirected graph represented as an adjacency matrix and an integer
k, write a function to determine whether each vertex in the graph can be
colored such that no two adjacent vertices share
the same color using at most k colors""" | StarcoderdataPython |
4805962 | import threading
import socket
from zeroconf import ServiceBrowser, ServiceStateChange, Zeroconf
from cac.client.scenes.select_server.list_box import ListBox, ListBoxItem
from cac.client.engine.game_object import GameObject
from cac.client.engine.events import EventPropagation
from cac.client.engine.curses_colour imp... | StarcoderdataPython |
1701092 | <gh_stars>10-100
from typing import Optional
from mypy.nodes import Node
from mypy.types import Instance
from mypy.types import Type as MypyType
from mypy.types import TypeType
def get_definition(typ: MypyType, arg: str) -> Optional[Node]:
"""Gets definition of a type from SymbolTableNode."""
if isinstance(t... | StarcoderdataPython |
3380299 | <gh_stars>0
from sanic import Sanic, Blueprint
from sanic.response import text, json
app = Sanic()
passing_bp = Blueprint('passing_blueprint')
failing_bp = Blueprint('failing_blueprint', url_prefix='/api/failing')
@passing_bp.get("/api/passing")
async def get_data(request):
return json({
"hello": "world... | StarcoderdataPython |
3225672 | #!/usr/bin/env python
from my_data import Data
def main():
# Looks and feels like normal python objects
objectList = [Data(1), Data(2), Data(3)]
# Print them out
for dataObject in objectList:
print(dataObject)
# Show the Mutability
objectList[1].set_value(1234)
print(objectList[... | StarcoderdataPython |
643 | from PhysicsTools.Heppy.analyzers.core.Analyzer import Analyzer
from PhysicsTools.Heppy.analyzers.core.AutoHandle import AutoHandle
from PhysicsTools.Heppy.physicsobjects.Tau import Tau
from PhysicsTools.HeppyCore.utils.deltar import deltaR, matchObjectCollection3
import PhysicsTools.HeppyCore.framework.config as cfg... | StarcoderdataPython |
3242923 | from flask import render_template
class Emails(object):
message_cls = None
def __init__(self, config, message_cls, celery):
if message_cls:
self.message_cls = message_cls
if not self.message_cls:
try:
from flask_emails import Message
sel... | StarcoderdataPython |
1741758 | #!/usr/bin/env python
import os
import errno
from rest_framework_ccbv.config import VERSION, REST_FRAMEWORK_VERSIONS
from rest_framework_ccbv.inspector import drfklasses
from rest_framework_ccbv.renderers import (DetailPageRenderer,
IndexPageRenderer,
... | StarcoderdataPython |
1686835 | ###############################################################################
# prop_mod.py
###############################################################################
#
# Calculate mod without numpy issue
#
###############################################################################
import numpy as np
from t... | StarcoderdataPython |
3259967 | <gh_stars>10-100
from distutils.core import setup
setup(name='external_library', packages=['external_library'])
| StarcoderdataPython |
3208933 | from pulumi import export
import pulumi_keycloak as keycloak
realm = keycloak.Realm("new-python-realm",
realm="my-example-python-realm"
)
export("realm_id", realm.id)
| StarcoderdataPython |
3365660 | from django.conf.urls import patterns, url
urlpatterns = patterns('portfolio',
url(r'^$', 'views.home', name="home"),
url(r'^(?P<id>\d+)-(?P<slug>[-\w]+)$', 'views.project', name="project"),
)
| StarcoderdataPython |
57599 | <filename>src/manual_solve.py
#!/usr/bin/python
# Student Information
# Student Name: <NAME>
# Student ID: 17232977
# Git: https://github.com/manmayajob/ARC
import os, sys
import json
import numpy as np
import re
import matplotlib.pyplot as plt
### YOUR CODE HERE: write at least three functions which solve
### spec... | StarcoderdataPython |
3300089 | #!/usr/bin/python
"""
This program to take the month-wise backup from PostgreSQL
and store it to IBM COS.
"""
__author__ = "<NAME>"
__copyright__ = "(c) Copyright IBM 2020"
__credits__ = ["BAT DMS IBM Team"]
__email__ = "<EMAIL>"
__status__ = "Production"
# Import the required libraries
# Import the sys library to pa... | StarcoderdataPython |
3293514 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | StarcoderdataPython |
1771652 | <reponame>wu-uw/OpenCompetition<filename>src/tabular/feature_engineering/feature_generator/symbolic_learning.py
# encoding:utf-8
import pandas as pd
from gplearn.genetic import SymbolicTransformer
from sklearn.model_selection import train_test_split
class GPConfig:
def __init__(self, feature_cols, target_col, gen... | StarcoderdataPython |
3310261 | <gh_stars>1-10
"""
LeetCode Problem: 1239. Maximum Length of a Concatenated String with Unique Characters
Link: https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters/
Language: Python
Written by: <NAME>
"""
class Solution:
def maxLength(self, arr: List[str]) -> int:
... | StarcoderdataPython |
1723624 | <gh_stars>1-10
#!/usr/bin/env python3
actions = {
"delete-alarms",
"describe-alarm-history",
"describe-alarms",
"describe-alarms-for-metric",
"disable-alarm-actions",
"enable-alarm-actions",
"get-metric-statistics",
"list-metrics",
"put-metric-alarm",
"put-metric-data",
"set... | StarcoderdataPython |
183590 | <filename>src/api/models/article/author.py
from ..base import BaseModel
from ..href import HrefModel
class AuthorModel(BaseModel):
def init(self):
self.add_property('name')
self.add_model_property('link', HrefModel)
| StarcoderdataPython |
182104 | <filename>alexber/utils/deploys.py
"""
This module is usable in your deployment script. See also `fabs` module.
See here https://medium.com/analytics-vidhya/my-ymlparsers-module-88221edf16a6 for documentation.
This module depends on some 3-rd party dependencies, in order to use it, you should have installed first. To... | StarcoderdataPython |
1679324 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 05 13:47:52 2018
@author: a002028
"""
import pandas as pd
class AttributeDict(dict):
"""Base class for attribute dictionaries."""
def __init__(self):
"""Initialize."""
super().__init__()
def _add_arrays_to_entries(self, **entries):
... | StarcoderdataPython |
3208804 | from imagedt.decorator import time_cost
import cv2 as cv
def brg2rgb(image):
(r, g, b) = cv.split(image)
return cv.merge([b, g, r])
def orb_detect(image_source, image_aim):
orb = cv.ORB_create()
kp1, des1 = orb.detectAndCompute(image_source, None)
kp2, des2 = orb.detectAndCompute(image_aim, Non... | StarcoderdataPython |
1666593 | <reponame>lucasw/imgui_ros
# Copyright 2018 <NAME>
import launch
import launch_ros.actions
import os
import yaml
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
# image_manip_dir = get_package_share_directory('image_manip')
# print('image_manip dir ' + i... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.