id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
337880 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | StarcoderdataPython |
1798493 | <filename>app/starling/routes.py
import base64
import hashlib
import json
from flask import request
from dateutil import parser
from app import db
from app.helpers import json_response
from app.starling import bp
from app.starling.models import StarlingTransaction
from app.users.models import User
@bp.route('/webho... | StarcoderdataPython |
11301862 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ____________developed by <NAME>____________________
# ________in collaboration with <NAME> _________
from colorama import Cursor, init, Fore, Back, Style
import re
#init()
STYLE = re.compile("\[[F,B,S][A-Z]\]")
print(Style.RESET_ALL)
color = {"[FR]": Fore.RED,
... | StarcoderdataPython |
269580 | <reponame>becarefullee/django-fitbit
# Your Fitbit access credentials, which must be requested from Fitbit.
# You must provide these in your project's settings.
FITAPP_CONSUMER_KEY = None
FITAPP_CONSUMER_SECRET = None
# The verification code for verifying subscriber endpoints
FITAPP_VERIFICATION_CODE = None
# Where t... | StarcoderdataPython |
1659695 | import os
import numpy as np
import scipy
import tensorflow as tf
from scipy.misc import imread
from tensorpack import DataFlow
class DatasetMetadata(object):
"""Helper class which loads and stores dataset metadata."""
def __init__(self, filename):
import csv
"""Initializes instance of Datas... | StarcoderdataPython |
12801885 | <gh_stars>1-10
__author__ = 'plasmashadow'
from .answer import *
from .questions import *
from .search import *
| StarcoderdataPython |
314280 | import bson
import pytz
import os.path
import tarfile
import datetime
import cStringIO
from .web import base
from .web.request import AccessType
from . import config
from . import util
from . import validators
import os
from .dao.containerutil import pluralize
log = config.log
BYTES_IN_MEGABYTE = float(1<<20)
def _f... | StarcoderdataPython |
11241844 | <reponame>dannyb2018/fastavro<filename>tests/test_utils.py
import random
from io import BytesIO
from fastavro import schemaless_writer
from fastavro.utils import generate_one, generate_many, anonymize_schema
def test_generate():
schema = {
"type": "record",
"name": "Test",
"namespace": "te... | StarcoderdataPython |
5101551 | import numpy as np
from skimage.transform import resize
from tqdm import tqdm
from dianna import utils
def normalize(saliency, n_masks, p_keep):
return saliency / n_masks / p_keep
def _upscale(grid_i, up_size):
return resize(grid_i, up_size, order=1, mode='reflect', anti_aliasing=False)
class RISE:
""... | StarcoderdataPython |
3289781 | <gh_stars>1-10
"""Author: <NAME>, Copyright 2019"""
import multiprocessing
import tensorflow as tf
import numpy as np
from mineral.core.savers.saver import Saver
from mineral.core.trainers.local_trainer import LocalTrainer
from mineral.core.monitors.local_monitor import LocalMonitor
from mineral.networks import Den... | StarcoderdataPython |
9780155 | # 1. find optimal binary values
# 2. make an order-index(by 1 0 difference desc)
# 3. increase a number 1 to K and apply order-index here
# 4. xor to optimal binary values
# 5. check if exists in impossible binaries
from audioop import reverse
T = int(input())
for tc in range(1, T+1):
# num of lines, num of impo... | StarcoderdataPython |
9745517 | #!/usr/bin/env python
# simple.py - bind a javascript function to python function
import STPyV8
with STPyV8.JSContext() as ctxt:
upcase = ctxt.eval("""
( (lowerString) => {
return lowerString.toUpperCase();
})
""")
print(upcase("hello world!"))
| StarcoderdataPython |
1612587 | import os
try:
from setuptools import setup
except ImportError:
from distutils import setup
long_description = open(os.path.join(os.path.dirname(__file__), "README.rst")).read()
setup(
name="iso8601",
version="0.1.12",
description=long_description.split("\n")[0],
long_description=long_descrip... | StarcoderdataPython |
9773257 | i = 0
listaNumeros = []
while i == 0:
num = int(input("Digite um numero para a lista: "))
listaNumeros.append(num)
i = int(input("Para continuar digite 0, para sair qualquer outro valor: "))
print("--------")
num = int(input("Digite um numero para busca: "))
def index(lista,numero):
i = 0
while i ... | StarcoderdataPython |
8102807 | t=int(input())
while t:
N = int(input())
S = list(input().split())
f = 0
for j in range(N):
if (j+1)<N and S[j]=="cookie" and S[j+1]!="milk":
f=1
break
elif S[N-1]=="cookie":
f=1
break
if f==1:
print("NO")
else:... | StarcoderdataPython |
353365 | <reponame>orionlee/PH_TESS_I_LightCurveViewer<gh_stars>1-10
#
# Helpers to download TESS-specific non-lightcurve data: TOIs, TCEs, etc.
#
import os
from pathlib import Path
import re
import shutil
import time
from types import SimpleNamespace
import warnings
from memoization import cached
import requests
import numpy... | StarcoderdataPython |
4899904 | from common.utils import read_file
from .adapters import get_num_arrangements, get_differences
def main() -> None:
adapters = read_file('d10/data/input.txt', int)
result = get_differences(adapters)
print(f"Result 1: {result}")
choices = get_num_arrangements(adapters)
print(f"Result 2: {choices} "... | StarcoderdataPython |
4997100 | <reponame>flucto-gmbh/SAAFOWE
#!/usr/bin/env python
import argparse
from datetime import datetime, timezone, timedelta
from glob import glob
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
from os import environ, path, makedirs
import sys
import pandas as pd
import time
de... | StarcoderdataPython |
1821540 | <filename>array_api_tests/test_special_cases.py
# We use __future__ for forward reference type hints - this will work for even py3.8.0
# See https://stackoverflow.com/a/33533514/5193926
from __future__ import annotations
import inspect
import math
import operator
import re
from dataclasses import dataclass, field
from... | StarcoderdataPython |
6583633 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
8034393 | from python_tsp.exact import solve_tsp_dynamic_programming
def alle_kanten(graph, knoten):
alle_kanten = []
for index1 in range(0,len(knoten)):
for index2 in range(index1+1,len(knoten)):
knoten1 = knoten[index1]
knoten2 = knoten[index2]
alle_kanten.append(graph[knoten1][knoten2])
return alle_kanten
... | StarcoderdataPython |
242115 | from os.path import join, basename, splitext
import os, glob, random
import numpy
import scipy.io
import mne
import pandas
from autoreject import AutoReject
from eegprep.bids.naming import filename2tuple
from eegprep.guess import guess_montage
from eegprep.util import (
resample_events_on_resampled_epochs,
plot... | StarcoderdataPython |
9605453 | import math
import random
from Instrucciones.TablaSimbolos.Instruccion import Instruccion
from Instrucciones.TablaSimbolos import Instruccion3D as c3d
from Optimizador.C3D import Valor as ClassValor
from Optimizador.C3D import OP_ARITMETICO as ClassOP_ARITMETICO
from Optimizador.C3D import Identificador as ClassIdentif... | StarcoderdataPython |
8012400 | <gh_stars>1-10
import config
import time
import logging; logging.basicConfig(level=logging.INFO)
import asyncio, os, json, time
from datetime import datetime
from aiohttp import web
from jinja2 import Environment, FileSystemLoader
from config import configs
import orm
from coroweb import add_routes, add_static, ad... | StarcoderdataPython |
3520479 | <gh_stars>0
from django.urls import path, include
from . import views
urlpatterns = (
path('admins/', views.DashboardView.as_view(), name='admins_dashboard'),
# urls for Product
path('admins/product/', views.ProductListView.as_view(), name='admins_product_list'),
path('admins/product/create/', views.... | StarcoderdataPython |
3511019 | """
Re-Space: Oh, no! You have accidentally removed all spaces, punctuation, and capitalization in a
lengthy document. A sentence like "I reset the computer. It still didn`t boot!"
became"iresetthecomputeritstilldidntboot': You'll deal with the punctuation and capi-
talization later; right now you need to re-insert the... | StarcoderdataPython |
219454 | <reponame>ma1VAR3/Enhanced-Noticeboard<gh_stars>0
from django.contrib import admin
# Register your models here.
from .models import Event,FAQ
admin.site.register(Event)
admin.site.register(FAQ)
| StarcoderdataPython |
174422 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenAppQrcodeCreateModel(object):
def __init__(self):
self._color = None
self._describe = None
self._query_param = None
self._size = None
self._url_p... | StarcoderdataPython |
3238282 | <filename>demo/cict_demo/cict_train_GAN.py
import os
import time
import json
import glob
import torch
import torch.optim as optim
import torchvision.transforms as transforms
from easydict import EasyDict
from PIL import Image
from torch.utils.data import DataLoader, WeightedRandomSampler
from torchvision.transforms.tr... | StarcoderdataPython |
1969405 | <filename>models.py
from peewee import *
from playhouse.migrate import *
db = SqliteDatabase('register.db')
migrator = SqliteMigrator(db)
class BaseModel(Model):
"""Base class that specifies the database."""
class Meta:
database = db
class User(BaseModel):
"""Users model."""
username = Ch... | StarcoderdataPython |
5023148 | <filename>hydrocode/scripts/dump_replayer.py
#!/usr/bin/env python3
import socket
import sys
import time
import numpy as np
sys.path.insert(0, '../modules')
import common.const
import comms.const
import pinger.const
def getSize(file):
file.seek(0, 2)
size = file.tell()
return size
# check whether dump ... | StarcoderdataPython |
11241490 | # coding=utf-8
import sys
import time
from config import *
def save_to_log_file(message):
global LOG_FILE_HANDLE
LOG_FILE_HANDLE.write(message)
def console(message):
sys.stdout.write(message + "\n")
def write(message):
is_msg_data = False
for msg in MSG_DATA:
if msg == message:
... | StarcoderdataPython |
260022 | <gh_stars>1-10
import yaml
import json
import argparse
class obj(object):
def __init__(self, d):
for a, b in d.items():
if isinstance(b, (list, tuple)):
setattr(self, a, [obj(x) if isinstance(x, dict) else x for x in b])
else:
setattr(self, a, obj(b) if... | StarcoderdataPython |
6448805 | <filename>no11/p2.py
# download music
import requests
import re
import execjs
import json
class Down(object):
def __init__(self):
pass
# 获取音乐文件的 ids 参数
def getids(self):
_headers = {'Referer': 'https://music.163.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64;... | StarcoderdataPython |
9645349 | <gh_stars>10-100
from . import exceptions
class AssetsClient(object):
ASSESTS_BASE_URI = '/api/search.json'
def __init__(self, client):
self.client = client
def list(self):
assets = []
uri = '/api.json'
assets = self.client.get(uri)
return assets
def get(sel... | StarcoderdataPython |
1728470 | <filename>sme_management/migrations/0009_auto_20200525_0142.py<gh_stars>1-10
# Generated by Django 3.0.6 on 2020-05-25 01:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sme_management', '0008_auto_20200525_0113'),
]
operations = [
m... | StarcoderdataPython |
5132242 | # -----------------------------------------------------------------------------
# Copyright (c) 2005-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this ... | StarcoderdataPython |
15273 | <gh_stars>0
"""
Znaleść kąt á, przy którym zasięg skoku z wahadła będzie maksymalny. Należy
posłużyć się metodą złotego podziału.
<NAME>
Index:216708
"""
import matplotlib.pyplot as plt
import numpy as np
class Zloty_podzial:
def __init__(self, h, line, a0):
tau = (np.sqrt(5) - 1) / 2
a = 0.2
... | StarcoderdataPython |
8198413 | from typing import Any, Generator, TypeVar
from pydantic import BaseModel
from pydantic.typing import AnyCallable
__all__ = [
"NormalizableModel",
]
T = TypeVar("T", bound="NormalizableModel")
CallableGenerator = Generator[AnyCallable, None, None]
class NormalizableModel(BaseModel):
"""A model that norma... | StarcoderdataPython |
3512793 | <gh_stars>1-10
"""Dataloader for pivot-based-entity-linking.
Encodes the knowledge base and pivoting language links using a trained entity similarity model.
Author: <NAME> (<EMAIL>)
Last update: 2019-04-15
"""
import codecs
from traindataloader import TrainDataLoader
from max_margin_encoder import MaxMarginEncoder
... | StarcoderdataPython |
1885223 | import logging
import uuid
from datetime import datetime
from benchmarks.async_redis_repository import save_order as saveOrder
from benchmarks.model import Order, OrderStatus, OrderResp, CreateOrderReq
from zero import ZeroSubscriber
async def hello_world(msg):
logging.info(msg)
async def save_order(msg):
... | StarcoderdataPython |
217031 | # Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/)
# Copyright (c) 2020-2021 <NAME> <<EMAIL>>
#
# MIT License
#
# 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 So... | StarcoderdataPython |
9620906 |
import os
import sys
from os import path
current_dir = path.dirname(path.abspath(__file__))
while path.split(current_dir)[-1] != r'Heron':
current_dir = path.dirname(current_dir)
sys.path.insert(0, path.dirname(current_dir))
from Heron import general_utils as gu
Exec = os.path.abspath(__file__)
#... | StarcoderdataPython |
3465785 | #!/usr/bin/env python
from QUBEKit.decorators import for_all_methods, timer_logger
from QUBEKit.helpers import append_to_log
from tempfile import TemporaryDirectory
from shutil import copy
from os import getcwd, chdir, path
from subprocess import run as sub_run
from collections import OrderedDict
from copy import dee... | StarcoderdataPython |
11380855 | #coding:utf-8
#
# id: bugs.core_4848
# title: MERGE ... WHEN NOT MATCHED ... RETURNING returns wrong (non-null) values when no insert is performed
# decription:
# tracker_id: CORE-4848
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_factor... | StarcoderdataPython |
9650004 | <gh_stars>1-10
from django.test import TestCase
from django_token_auth.user import TokenAuthenticatedUser
from django_token_auth.user import UserHasNoData
class TokenAuthenticatedUserTestCase(TestCase):
def test_user_class(self):
user = TokenAuthenticatedUser('john', 'some_token')
self.assertEqua... | StarcoderdataPython |
3550927 | <gh_stars>0
"""
A module containing unit tests for the `bitmask` modue.
:Authors: <NAME>
"""
from __future__ import (absolute_import, division, unicode_literals,
print_function)
import warnings
import numpy as np
import pytest
from stsci.tools import bitmask
MAX_INT_TYPE = np.maximum_sctype... | StarcoderdataPython |
3449837 | <reponame>Lucas-Mc/physionet-build<filename>physionet-django/project/migrations/0008_auto_20190314_1322.py
# Generated by Django 2.1.7 on 2019-03-14 17:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project', '0007_auto_20190308_1445'),
]
o... | StarcoderdataPython |
9643428 | <reponame>abb-iss/distributed-fuzzy-vault
"""
Chaff Points Generator to create randomized Minutia
"""
import random
from Minutia import MinutiaNBIS
import Constants
class ChaffPointsGenerator:
@staticmethod
def generate_chaff_points_randomly(amount, genuine_minutiae, smallest_minutia_rep, minutia_convert... | StarcoderdataPython |
4920330 | <reponame>sbl1996/pytorch-hrvvi-ext
import torch.nn as nn
from horch.nn import Flatten
from horch.models.layers import Conv2d, Linear
class LeNet5(nn.Module):
def __init__(self, in_channels=1, num_classes=10, dropout=None):
super().__init__()
self.features = nn.Sequential(
Conv2d(in_... | StarcoderdataPython |
1821547 | import ast
while True:
try:
string = raw_input('What numbers should I average? ')
words = string.split()
numbers = [ast.literal_eval(word) for word in words]
total = sum(numbers)
count = len(numbers)
average = 1.0 * total / count
print 'The average is', avera... | StarcoderdataPython |
1981643 | def main():
n = int(input())
a = 'I hate it'
b = 'I hate that'
c = 'I love it'
d = 'I love that'
for i in range(1,n):
if i % 2 == 1:
print(b,end=" ")
else:
print(d,end=" ")
if n % 2 == 1:
print(a,end=" ")
if n % 2 == 0:
print(c,end=... | StarcoderdataPython |
4943380 | <reponame>capriciash/civicu_app
import os
import sys
import json
import django
from django.conf import settings # noqa Django magic starts here
import PIL.Image
from PIL.ExifTags import TAGS as tag_num2name
# `labeler_site` must be a python package installed in your environment (virtualenv)
# OR "install" it manua... | StarcoderdataPython |
3399968 | <filename>src/centrol_bots/centrol_discord.py
from configs.user_messages import (
CHART_NOT_AVAILABLE,
ALERT_KEY_NOT_KNOWN,
HOT_TIP_1,
HOT_TIP_2,
HOT_TIP_3,
HOT_TIP_4,
HOT_TIP_5,
HOT_TIP_6,
HOT_TIP_7,
)
from discord_slash.utils.manage_commands import create_option, create_... | StarcoderdataPython |
6591196 | <reponame>mgfzemor/Computational-Biology
import hashlib
subsequences = {}
def read_file():
sequence = ""
file = open("file/sequence.fasta","r")
file.readline()
for line in file.readlines():
sequence += line[:-1]
return sequence
def set_subsequence(sequence):
global subsequences
seq... | StarcoderdataPython |
11342326 | from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(name='negentropy',
version='0.2',
description='C64 disassembler',
long_description=readme(),
long_description_content_type='text/markdown',
classifiers=[
'Development Status ... | StarcoderdataPython |
12829974 | <reponame>matinraayai/ibex<filename>evaluation/classification.py
import numpy as np
from numba import jit
from sklearn.metrics import auc, average_precision_score, precision_recall_curve, roc_curve
@jit(nopython=True)
def Prob2Pred(probabilities, threshold=0.5):
nentries = probabilities.shape[0]
predictions ... | StarcoderdataPython |
1677028 | import pandas as pd
import numpy as np
import os
import datetime
# Helpers
# Identify Win/Loss Streaks if any.
def get_3game_ws(last_matches):
if hasattr(last_matches, "__len__"):
return 1 if len(last_matches) > 3 and last_matches[-3:] == 'WWW' else 0
return np.nan
def get_5game_ws(last_matches):
... | StarcoderdataPython |
3410090 | """
Initialize the TCKDB backend app tests models module
"""
| StarcoderdataPython |
11203065 | import _plotly_utils.basevalidators
class HoveronValidator(_plotly_utils.basevalidators.FlaglistValidator):
def __init__(self, plotly_name='hoveron', parent_name='violin', **kwargs):
super(HoveronValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | StarcoderdataPython |
3491499 | <reponame>deeplow/nose2
import sys
# This unused import is not very elegant, but it allows eggdiscovery to be found in
# Travis (or when run with PYTHONPATH=.)
import nose2.plugins.loader.eggdiscovery # noqa: F401
from nose2.tests._common import FunctionalTestCase, support_file
try:
import pkg_resources
except ... | StarcoderdataPython |
11356129 | # coding:utf-8
"""Application to print some info about model
"""
# MIT License
# Copyright (c) 2020 sMedX
import click
from pathlib import Path
import tensorflow.compat.v1 as tf
from facenet import tfutils, config, nodes
@click.command()
@click.option('--config', default=config.default_model_path, type=Path,
... | StarcoderdataPython |
106764 | """Version and details for pcraft"""
__description__ = "Pcraft"
__url__ = "https://www.github.com/devoinc/pcraft"
__version__ = "0.1.4"
__author__ = "<NAME>"
__author_email__ = "<EMAIL>"
__license__ = "MIT"
__maintainer__ = __author__
__maintainer_email__ = __author_email__
| StarcoderdataPython |
9735649 | # discretization.py
#
# This file is part of scqubits: a Python package for superconducting qubits,
# arXiv:2107.08552 (2021). https://arxiv.org/abs/2107.08552
#
# Copyright (c) 2019 and later, <NAME> and <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# ... | StarcoderdataPython |
6597553 | <filename>tests/conftest.py
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2021, <NAME>
# All rights reserved.
# --------------------------------------------------------
import json... | StarcoderdataPython |
6684059 |
from pw2qmcpack import Pw2qmcpack,Pw2qmcpackInput,Pw2qmcpackAnalyzer
from wfconvert import Wfconvert,WfconvertInput,WfconvertAnalyzer
| StarcoderdataPython |
304134 | #Ask the user for a string and print out whether this string is a palindrome or not.
# (A palindrome is a string that reads the same forwards and backwards.)
str = input("Let's have a string, shall we?")
palindrome = str[::-1]==str
if palindrome:
print(str,"is a palindrome")
else:
print(str, "is not a palindr... | StarcoderdataPython |
4919931 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestCase
import mock
import json
import urllib2
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from libdict.macmillan import models, query_site
words = [
'take-on', # multiple keys in last sense
'yours', # intr... | StarcoderdataPython |
3418744 | <gh_stars>0
import drawBot as db
import vanilla
from vanilla.dialogs import putFile
from random import random
class MyInterface:
def __init__(self):
self.pdf = None
self.w = vanilla.Window((600, 900), "My Interface")
self.w.drawButton = vanilla.Button((10, 10, 100, 2... | StarcoderdataPython |
4817087 | <filename>tabcmd/commands/group/delete_group_command.py
import tableauserverclient as TSC
from tabcmd.commands.auth.session import Session
from tabcmd.commands.constants import Errors
from tabcmd.commands.server import Server
from tabcmd.execution.localize import _
from tabcmd.execution.logger_config import log
clas... | StarcoderdataPython |
12810742 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
'''
遍历
'''
def isSymmetric(self, root):
if root == None:
return True
deQueue = [root.left, ... | StarcoderdataPython |
6531637 | spam = ['hey','howdy','hiya','hello']
print(spam)
print(spam.index('hiya'))
spam.append('hi')
spam.insert(0,'privet')
print(spam)
spam.remove('hello')
spam.sort()
print(spam)
spam2 = spam.copy()
spam.sort(reverse=True,key=str.lower)
print(spam)
spam2 = spam.copy()
spam2[2] = 'test'
print(spam)
print(spam2) | StarcoderdataPython |
11378359 | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
11209684 | from lib import action
class NomadGetPoliciesAction(action.NomadBaseAction):
def run(self):
return self.nomad.acl.get_policies()
| StarcoderdataPython |
3480697 | <gh_stars>1-10
"""Tests for fast5seek package."""
import unittest
import logging
import io
from contextlib import redirect_stdout
from fast5seek import fast5seek
logging.disable(logging.CRITICAL)
class TestBamReadIdExtraction(unittest.TestCase):
"""Test the read id extracxtion functions for bam and sam"""
d... | StarcoderdataPython |
8070965 | <gh_stars>10-100
from toolz.curried import * # noqa
from misoc.interconnect import stream
from migen_axi.interconnect import axi, Reader
from .common import write_ack, wait_stb, file_tmp_folder
from migen.sim import run_simulation
def write_data(sink, val, eop=None):
yield sink.data.eq(val)
if eop:
y... | StarcoderdataPython |
3521212 | <reponame>datadonK23/rot-weisse-wurzeln
#!/usr/bin/python
""" locate_control
Add Locate control to folium Map.
Based on leaflet plugin: https://github.com/domoritz/leaflet-locatecontrol
Taken from Folium PR#1116 and slightly modified.
Utility methods 'parse_options' and 'camelize' taken from Folium master branch.
A... | StarcoderdataPython |
304884 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""Test columns"""
import unittest
from pyrseas.testutils import InputMapToSqlTestCase, fix_indent
CREATE_STMT1 = "CREATE TABLE t1 (c1 integer, c2 text)"
CREATE_STMT2 = "CREATE TABLE t1 (c1 integer, c2 text, c3 date)"
CREATE_STMT3 = "CREATE TABLE t1 (c1 integer, c2 text, c3 dat... | StarcoderdataPython |
9678420 | # -*- coding: utf-8 -*-
# @Time : 2018/3/29 上午10:06
# @Author : Azrael.Bai
# @File : reverse_string.py
class Solution(object):
def reverseString(self, s):
"""
:type s: str
:rtype: str
"""
return s[::-1]
if __name__ == '__main__':
s = Solution()
print(s.reve... | StarcoderdataPython |
5041446 | <reponame>dhermes/project-euler<gh_stars>1-10
#!/usr/bin/env python
from python.decorators import euler_timer
from python.functions import inverse_mod_n
from python.functions import sieve
def main(verbose=False):
PRIMES = sieve(10 ** 6 + 3) # 10**6 + 3 is the final value of p_2
running_sum = 0
for inde... | StarcoderdataPython |
11328179 | from ._iea34_130rwt import IEA34_130_1WT_Surrogate, IEA34_130_2WT_Surrogate
| StarcoderdataPython |
1977537 |
SECRET = '<KEY>'
DATABASE = 'sqlite:///catalog.db'
CLIENT_GOOGLE_SECRET='client_secret_google.json' | StarcoderdataPython |
8152075 | from .spykingcircussortingextractor import SpykingCircusSortingExtractor | StarcoderdataPython |
4827472 | from functools import reduce
from operator import getitem
from inspect import getdoc
from werkzeug.exceptions import NotFound
from yggdrasil.record import Record
from . import Page
class Root(Page):
def __init__(self, urlmap):
self.urlmap = urlmap
def render_rule(self, request, rule):
resul... | StarcoderdataPython |
1979 | # --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank = pd.read_csv(path)
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var)
numerical_var = bank.select_dtypes(include = 'number')
print(numeric... | StarcoderdataPython |
3371316 | <reponame>tcysin/portfolio
"""
This module contains functionality for finding duplicated and near-duplicated
images.
TODO better description
TODO which methods do we use here?
"""
from collections import defaultdict
from typing import Dict, Iterable, List
import numpy as np
from PIL import Image
from scipy import sp... | StarcoderdataPython |
4803955 | <gh_stars>0
import sys
import os
import browser
import changelog
args = sys.argv
if len(args) == 2 and args[1] == "--version":
print("Glopi Alpha 4")
exit()
if len(args) == 2 and (args[1] == "--help" or args[1] == "--usage"):
print("Look at the readme(.md) for help!")
exit()
if len(args) > 2 and ar... | StarcoderdataPython |
4800419 | <reponame>lietu/moat<gh_stars>0
class Message(object):
def __init__(self, game, player_id, data):
self.game = game
self.player_id = player_id
for key in data:
setattr(self, key, data[key])
self.validate()
def validate(self):
raise NotImplementedError("Messa... | StarcoderdataPython |
231441 | <reponame>mish24/werk
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import random
try:
from queue import Queue
except ImportError:
from Queue import Queue
from waflib import Utils,Task,Errors,Logs
GAP=20
class Consumer(Utils.threading.Thread):... | StarcoderdataPython |
1920734 | <reponame>pduchesne/ckanext-digitalwallonia
'''plugin.py
'''
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import ckan.plugins as p
from ckanext.spatial.interfaces import ISpatialHarvester
from ckan.common import json
class ADNThemePlugin(plugins.SingletonPlugin):
'''ADN theme plugin.
... | StarcoderdataPython |
9718128 | <filename>tests/checkpoint/conftest.py
import os
import shutil
import pytest
from great_expectations import DataContext
from great_expectations.core import ExpectationConfiguration
from great_expectations.data_context.util import file_relative_path
@pytest.fixture
def titanic_pandas_data_context_stats_enabled_and_e... | StarcoderdataPython |
5103685 | print('----------first demo----------')
temp = input("不妨猜一下XXX现在心里想的是哪个数字:")
guess = int(temp)
if guess == 8:
print("好厉害好厉害,你是XXX心里的蛔虫吗?")
print("哼,猜中了也没有奖励!")
else:
print("猜错啦,XXX现在心里想的是8!")
print("游戏结束,不玩啦^_^")
| StarcoderdataPython |
1772543 | <reponame>AitanG/numpy-string-indexed<gh_stars>0
import copy
import numpy as np
from . import friendly_matrix as fm
__all__ = [
'moveaxis_A',
'moveaxis',
'swapaxes_A',
'swapaxes',
'transpose_A',
'transpose',
'concatenate_A',
'concatenate',
'stack_A',
'stack',
'vstack_A',
... | StarcoderdataPython |
6443386 | <gh_stars>0
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
#1:the name of the url we are wish to create ..
#2:the viewset we wish to register
#3: base name for our viewset
router.register('hello-viewset', views.HelloViewSe... | StarcoderdataPython |
6420578 | <reponame>Hugking/lin-cms-flask<gh_stars>0
import sys
import os
sys.path.append((os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))))
from app.app import create_app
app = create_app()
def test_new_cate():
with app.test_client() as c:
rv = c.post('/wx/shop/cate/', json={
'name': ... | StarcoderdataPython |
137405 |
students = []
class Student:
# Python 没有权限控制, 所有的方法都是 public ,可以通过规范命名去说明
# class property
school_name = "SHICHENGZHOGNXUE"
def __init__(self, name, stu_id=110):
# instance property
self.name = name
self.stu_id = stu_id
students.append(self)
def get_name_capita... | StarcoderdataPython |
9741766 | <reponame>Amanjakhetiya/Data_Structures_Algorithms_In_Python<filename>Tree/Trie/Trie.py<gh_stars>100-1000
"""
Implementation of Trie data structure.
"""
class Node:
def __init__(self, value=None, isComplete=False):
self.isComplete = isComplete
self.children = {}
self.value = value
... | StarcoderdataPython |
4892815 | <reponame>jumpscale7/jumpscale_core7
from JumpScale import j
from pymongo import MongoClient, MongoReplicaSetClient
class MongoDBClient:
def get(self, host='localhost', port=27017):
try:
client = MongoClient(host, int(port))
except Exception as e:
raise RuntimeError('Could... | StarcoderdataPython |
6419133 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
def int_parameter(level, maxval):
return int(level * maxval / 10)
def float_parameter(level, maxval):
return float(l... | StarcoderdataPython |
1649271 | <reponame>rykehg/produtosPyFlaskJWTTests
from flask import Flask, jsonify
from flask_jwt_extended import JWTManager
from flask_restful import Api
from blacklist import BLACKLIST
from config import JwtBackList, JwtSecret, MySQL, SQLAlchemyMod
from models.sql_alchemy import db, initialize_db
from resources.routes import... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.