id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
3305767 | <reponame>m1yag1/zenhub_charts<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-23 16:06
from __future__ import unicode_literals
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
cla... | StarcoderdataPython |
1807754 | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
class App():
def __init__(self):
rospy.init_node("app_node", anonymous=False) # informações gerais do dó
rospy.Subscriber("sensor/value", Int32, self.update) # subscrito com callback
self.value = Int32... | StarcoderdataPython |
9741421 | from .base_options import BaseOptions
import os
class TestOptions(BaseOptions):
"""This class includes training options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser)
parser.add_argument('--frame... | StarcoderdataPython |
1641432 | <gh_stars>0
# Generated by Django 3.0 on 2020-01-20 16:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0009_shoppingcart'),
]
operations = [
migrations.DeleteModel(
name='ShoppingCart',
),
]
| StarcoderdataPython |
1979125 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
import random
from django.db import models, migrations
def default_email_keys(apps, schema_editor):
user_model = apps.get_model("gatekeeper", "User")
for user in user_model.objects.all():
salt = hashlib.sha1(str(random.ran... | StarcoderdataPython |
3509331 | <gh_stars>0
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
app = Flask(__name__)
app.config.from_object('config')
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0')
db = SQLAlchemy(app)
migrate = Migrate(... | StarcoderdataPython |
3566921 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | StarcoderdataPython |
362560 | import utool as ut
from fixtex import latex_parser
def testdata_fpaths():
dpath = '.'
#tex_fpath_list = ut.ls(dpath, 'chapter*.tex') + ut.ls(dpath, 'appendix.tex')
patterns = [
'chapter*.tex',
'sec-*.tex',
'figdef*.tex',
'def.tex',
'pairwise-classifier.tex',
... | StarcoderdataPython |
120716 | from .views import token_bp
| StarcoderdataPython |
1875754 | # Copyright 2021 Adobe. All rights reserved.
# This file is licensed to you 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 ... | StarcoderdataPython |
1647917 | <gh_stars>0
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import unittest
from data_aggregator.models import Job
from data_aggregator.management.commands._mixins import RunJobMixin
from django.test import TestCase
from mock import MagicMock, patch
class TestRunJobMixin(TestCa... | StarcoderdataPython |
1846226 | <gh_stars>0
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
database = sb.load_dataset("flights")
print(database)
#Default kindnnya = "strip"
#sb.catplot(x="month",y="passengers",data=database,kind='violin')
sb.catplot(x="month",y="passengers",data=databa... | StarcoderdataPython |
4838617 | import re
from generators.common.Helper import Helper, AttributeKind
class PythonHelper(Helper):
@staticmethod
def add_required_import(required_import: set, import_type, class_name, base_class_name):
for typename in re.split('[\\[\\]]', import_type):
if typename:
if typen... | StarcoderdataPython |
6522059 | # Copyright 2017 The Bazel 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 applicable la... | StarcoderdataPython |
4851927 | <reponame>jstremme/classifier-recall-over-time
import dash
import pandas as pd
import numpy as np
import plotly.graph_objs as go
from utilities.color_palette import ColorPalette
from utilities.load_data import get_performance_values
def create_callbacks(app):
@app.callback(dash.dependencies.Output('graph', 'figur... | StarcoderdataPython |
6470533 | <filename>mininet/topo.py<gh_stars>1-10
#!/usr/bin/python
# Copyright 2019-present Open Networking Foundation
#
# 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.o... | StarcoderdataPython |
3308144 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... | StarcoderdataPython |
6512977 | <reponame>Mediotaku/Kanji-Recognition
# importamos los modulos necesarios de keras
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from keras.utils import np_utils
from keras.models import model_from_json
import matplotlib.pyplot as plt
import numpy as np
# cargar datos de mnis... | StarcoderdataPython |
8185026 | """
http://community.topcoder.com/stat?c=problem_statement&pm=1692
Single Round Match 146 Round 1 - Division II, Level One
Single Round Match 212 Round 1 - Division II, Level One
"""
class Yahtzee:
def maxPoints(self, toss):
sums = [0] * 7
for value in toss:
sums[value] += value
... | StarcoderdataPython |
8193554 | # SPDX-FileCopyrightText: 2014 <NAME> for Adafruit Industries
# SPDX-License-Identifier: MIT
# This example is for use on (Linux) computers that are using CPython with
# Adafruit Blinka to support CircuitPython libraries. CircuitPython does
# not support PIL/pillow (python imaging library)!
from board import S... | StarcoderdataPython |
6641838 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\conta\Documents\script\Wizard\App\ui_files\error_handler.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you... | StarcoderdataPython |
1959753 | <filename>release-assistant/test/test_start/test_start_cli.py<gh_stars>1-10
#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software acc... | StarcoderdataPython |
5180974 | <reponame>blockchain-etl/iotex-etl<filename>airflow/dags/mainnet_export_dag.py
from __future__ import print_function
from iotexetl_airflow.build_export_dag import build_export_dag
from iotexetl_airflow.variables import read_export_dag_vars
# airflow DAG
DAG = build_export_dag(
dag_id='mainnet_export_dag',
**r... | StarcoderdataPython |
3560320 | <filename>app.py
from flask import Flask, request, jsonify
from NostaleVersionGet import NostaleVersionGet
import json
import time
import NostaleServerStatusBot
import os
app = Flask(__name__)
@app.route('/')
def index():
try:
f = open("cache.json")
d = json.load(f)
if d['lastUpdateTime'] ... | StarcoderdataPython |
1897829 | <filename>v1/pi/CamCalibration.py
import sched, time, threading
import serial
from tendo import singleton
from SimpleCV import *
me = singleton.SingleInstance() # will sys.exit(-1) if another instance is running
# Define some colors
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
# Init serial
ser = serial.S... | StarcoderdataPython |
6516618 | <reponame>etheleon/tools
#!/usr/bin/env python
import os
import re
import sqlite3
import argparse
from Bio import SeqIO
def storeInSQL(sqlite3File, koFolder, debug=False):
'''
Creates a NEW sqlite3 DB and stores the ko information inside it
'''
kos_unfiltered = os.listdir(koFolder)
kos = [ko fo... | StarcoderdataPython |
3449873 | from konverter.utils.model_attributes import Activations, Layers, watermark
from konverter.utils.konverter_support import KonverterSupport
import numpy as np
support = KonverterSupport()
class Konverter:
def __init__(self, model, output_file, indent_spaces, verbose=True, use_watermark=True):
"""
:param mod... | StarcoderdataPython |
3349935 | import os
import socket
import sys
from StringIO import StringIO
from multiprocessing.pool import ThreadPool
from threading import Thread
import time
from paramiko import SSHClient, AutoAddPolicy, RSAKey
from paramiko.ssh_exception import NoValidConnectionsError
from scpclient import Write, SCPError
from cloudshell.c... | StarcoderdataPython |
11358070 | from ex108 import moeda
p = float(input('Digite o preço: R$ '))
print(f'A metade de R$ {moeda.moeda(p)} é R$ {moeda.moeda(moeda.metade(p))}')
print(f'O dobro de R$ {moeda.moeda(p)} é R$ {moeda.moeda(moeda.dobro(p))}')
print(f'Aumentando 10%, temos {moeda.moeda(moeda.aumentar(p, 10))}')
print(f'Diminuindo 10%, temos {m... | StarcoderdataPython |
9686268 | def testing_image(input_image):
# Convert to HSV
hsv = cv2.cvtColor(input_image, cv2.COLOR_RGB2HSV)
# HSV channels
h = hsv[:, :, 0]
s = hsv[:, :, 1]
v = hsv[:, :, 2]
# HSV mask
hsv_lower = np.array([0, 0, 0])
hsv_upper = np.array([255, 35, 255])
hsv_mask = cv2.inRange(hsv, hsv_... | StarcoderdataPython |
20179 | from django.test import TestCase
from django.urls import reverse_lazy
from ..models import PHOTO_MODEL, UploadedPhotoModel, IMAGE_SIZES
from .model_factories import get_image_file, get_zip_file
import time
from uuid import uuid4
class UploadPhotoApiViewTest(TestCase):
def check_photo_ok_and_delete(self, photo):
... | StarcoderdataPython |
6524758 | <reponame>NREL/VirtualEngineering
# Init file for vebio package | StarcoderdataPython |
6583144 | <gh_stars>0
import functools
import json
import itertools
from couchdbkit.exceptions import DocTypeError
from corehq import Domain
from corehq.apps.app_manager.const import CT_REQUISITION_MODE_3, CT_LEDGER_STOCK, CT_LEDGER_REQUESTED, CT_REQUISITION_MODE_4, CT_LEDGER_APPROVED, CT_LEDGER_PREFIX
from corehq.apps.app_manag... | StarcoderdataPython |
3217748 | from unittest import TestCase
from .base_type_rxt import SingleField, SingleField_deserialize, SingleField_serialize,MultiFields
class BaseTypeSerializationTestCase(TestCase):
def test_create_SingleField(self):
item = SingleField(42)
self.assertEqual(42, item.foo32)
def test_create_MultiFiel... | StarcoderdataPython |
6696404 | <reponame>bogdan824/LeetCode-Problems
def thousandSep(n):
x = str(n)
if len(x)<=3:
return x
for i in range(len(x),0,-3):
x = x[:i] + '.' + x[i:]
return x[:-1]
n = 12345678912345678
print(thousandSep(n)) | StarcoderdataPython |
4915184 | import os
from setuptools import setup, find_packages
from setuptools.command.test import test
from unittest import TestLoader
MAJOR_VERSION = 4
MINOR_VERSION = 3
PATCH_VERSION = 9
# Environment variable into which CI places the build ID
# https://docs.gitlab.com/ce/ci/variables/
CI_BUILD_ID = 'BUILD_NUMBER'
class ... | StarcoderdataPython |
9618610 | <gh_stars>10-100
import tensorflow as tf
import cv2 as cv
import random
import os
import math
import numpy as np
from tensorflow.contrib.framework.python.ops import add_arg_scope
def random_interpolates(x, y, alpha=None):
"""
x: first dimension as batch_size
y: first dimension as batch_size
alpha: [BAT... | StarcoderdataPython |
1729606 | <filename>bitwise.py
#!/Applications/anaconda/envs/Python3/bin
def main():
'''Bitwise Operators and Examples'''
x, y, allOn = 0x55, 0xaa, 0xff
print("x is: ", end="")
bitPrint(x)
print("y is: ", end="")
bitPrint(y)
print("allOn is: ", end="")
bitPrint(allOn)
# Bitwise OR: |
p... | StarcoderdataPython |
4869989 | <reponame>cloudsoft/brooklyn-marklogic<gh_stars>0
import sys
try:
import requests
except ImportError:
print "Couldn't import requests. Have you run `sudo pip install requests`?"
sys.exit(1)
def loadApps(entities=[]):
payload = {'items': ','.join(entities)}
return requests.get('http://localhost:808... | StarcoderdataPython |
1896935 | <filename>exp/bezier/diff_exp.py<gh_stars>100-1000
from sympy import *
#f = Function('f')
#eq = Derivative(f(x), x) + 1
#res = dsolve(eq, f(x), ics={f(0):0})
#print(res)
x = Function('x')
y = Function('y')
t = symbols('t')
x1, y1, x2, y2, yx1, yx2 = symbols('x1 y1 x2 y2 yx1 yx2')
# constant speed
eq = Derivative(Der... | StarcoderdataPython |
11288346 | """ This script defines an example automated tron client that will avoid walls if it's about to crash into one.
This is meant to be an example of how to implement a basic matchmaking agent.
"""
import argparse
from random import choice, randint
from colosseumrl.envs.tron.rllib import SimpleAvoidAgent
from colosseu... | StarcoderdataPython |
187161 | <gh_stars>0
# Code from Chapter 6 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with n... | StarcoderdataPython |
221768 | <gh_stars>0
from uuid import uuid4
from cascade.core.context import ExecutionContext
def make_execution_context(**parameters):
defaults = {"database": "dismod-at-dev", "bundle_database": "epi"}
defaults.update(parameters)
context = ExecutionContext()
context.parameters = defaults
context.paramete... | StarcoderdataPython |
4964099 | from __future__ import annotations
from typing import Optional
import homeassistant.helpers.config_validation as cv
import homeassistant.helpers.entity_registry as er
import voluptuous as vol
from homeassistant.core import State
from .const import CONF_POWER, CONF_STATES_POWER
from .strategy_interface import PowerCa... | StarcoderdataPython |
1770426 | # Keras implementation of the paper:
# 3D MRI Brain Tumor Segmentation Using Autoencoder Regularization
# by <NAME>. (https://arxiv.org/pdf/1810.11654.pdf)
# Author of this code: <NAME> (https://github.com/IAmSUyogJadhav)
from blocks import *
from utils import *
import torch
import torch.nn as nn
from collections impo... | StarcoderdataPython |
6437544 | #Author : <NAME>
import torch
class Config:
DEVICE = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
STORAGE_BUCKET = 'gs://storage_bucket_speech'
LOCAL_PATH = 'tmp'
OUTPUT_PATH = 'output'
TRAIN_DATA_DIR = '../../feature-extraction/train'
VALID_DATA_DIR = '../..... | StarcoderdataPython |
11327873 | <gh_stars>0
# coding: utf-8
"""
Payoneer Mobile API
Swagger specification for https://mobileapi.payoneer.com
OpenAPI spec version: 0.9.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import pay... | StarcoderdataPython |
1980144 | <reponame>bmwant/chemister
from abc import ABC, abstractmethod
from crawler.db import get_engine
from crawler.cache import Cache
from crawler.models.transaction import (
NewTransaction,
get_transactions,
insert_new_transaction,
close_transaction,
get_hanging_transactions,
)
from utils import Loggab... | StarcoderdataPython |
6643734 | <reponame>BackQuote/backtester<filename>db/upload_quotes.py
import os
import sys
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(current_dir + '/../server')
from models import Ticker, Day
ultimate_dir = current_dir +... | StarcoderdataPython |
9603080 | from aerosandbox.dynamics.rigid_body.rigid_2D import *
from aerosandbox.dynamics.rigid_body.rigid_3D import * | StarcoderdataPython |
160746 | <reponame>Impavidity/relogic
import torch
import torch.nn as nn
class SpanGCNModule(nn.Module):
"""
SpanGCN firstly extract span from text, and then label each span based
on the learned representation of GCN
"""
def __init__(self, config, task_name, boundary_n_classes=None, label_n_classes=None):
super... | StarcoderdataPython |
4812875 | """
Copyright 2014 <NAME>
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
distrib... | StarcoderdataPython |
4871881 | <reponame>Nathaniel-Haines/easyml<gh_stars>1-10
"""Functions for sampling data.
"""
import numpy as np
__all__ = []
def resample_equal_proportion(X, y, train_size=0.667):
"""Sample in equal proportion.
Parameters
----------
:param y: array, shape (n_obs) Input data to be split
:param train_size... | StarcoderdataPython |
5157958 | from CTFd.admin import config
from flask import render_template, request
from CTFd.models import (
Challenges
)
from CTFd.utils.dates import ctf_ended, ctf_paused, ctf_started
from CTFd.utils.user import authed
from CTFd.utils.helpers import get_errors, get_infos
from CTFd.utils.decorators import (
require_ve... | StarcoderdataPython |
5069275 | """Module containing the entrypoint to the bot"""
import discord
from discord.ext.commands import Bot
import logging
import redis
from buffs import (
handle_buff_message,
is_buff_message,
)
from commands.help import HelpCommandCog
from commands.configuration import FeatureConfigurationCog
from gear_check impor... | StarcoderdataPython |
11213083 | <filename>mcmcplot/utilities.py<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 14 06:24:12 2018
@author: prmiles
"""
import numpy as np
from scipy import pi, sin, cos
import sys
import math
def check_settings(default_settings, user_settings=None):
'''
Check user settings ... | StarcoderdataPython |
6599109 | #%%
from prettytable import PrettyTable
#%%
class CVP:
def __init__(self, speakers, sales_pu, var_exp_pu, fix_exp, target_profit):
self.sales_pu = sales_pu
self.speakers = speakers
self.var_exp_pu = var_exp_pu
self.fix_exp = fix_exp
self.target_profit = target_profit
de... | StarcoderdataPython |
1872952 | import logging
import unittest
import acme.messages
from acmetk import AcmeProxy
from tests.test_broker import TestBrokerLocalCA, TestBrokerLE
from tests.test_ca import TestAcmetiny, TestOurClient, TestOurClientStress, TestCertBot
log = logging.getLogger("acmetk.test_proxy")
class TestProxy:
"""Tests for the Ac... | StarcoderdataPython |
11307753 | <reponame>hozuki/gfan<gh_stars>1-10
import numpy as np
from sklearn.datasets import load_files as load_sklearn_data_files
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import Mul... | StarcoderdataPython |
39965 | <reponame>WillBickerstaff/sundial
def splitbylength(wordlist):
initlen = len(wordlist[0])
lastlen = len(wordlist[-1])
splitlist = []
for i in range(initlen, lastlen+1):
curlist = []
for x in wordlist:
if len(x) == i: curlist.append(x.capitalize())
... | StarcoderdataPython |
277081 | import typing
def pascal(n: int, mod: int) -> typing.List[int]:
c = [[0] * n for _ in range(n)]
for i in range(n):
c[i][0] = 1
for i in range(1, n):
for j in range(1, i + 1):
c[i][j] = c[i - 1][j] + c[i - 1][j - 1]
c[i][j] %= mod
return c
def mai... | StarcoderdataPython |
11397142 | """
Purpose
-------
This fdw can be used to access data stored in a remote RDBMS.
Through the use of sqlalchemy, many different rdbms engines are supported.
.. api_compat::
:read:
:write:
:transaction:
:import_schema:
Dependencies
------------
You will need the `sqlalchemy`_ library, as well as a s... | StarcoderdataPython |
4900439 | import conexao_bd
conexao_bd.listar()
print(conexao_bd)
import xlwt
from datetime import datetime, timedelta
##style0 = xlwt.easyxf('font: name Times New Roman, color-index red, bold on',
## num_format_str='#,##0.00')
style0 = xlwt.easyxf('font: name Times New Roman, color-index blue, bold on, size 12... | StarcoderdataPython |
11220477 | <reponame>kanchenxi04/vnpy-app
# -*- coding: utf-8 -*-
# 对应网址:https://www.joinquant.com/post/4739
#【缠论】日线分笔&画图显示
from chan_lun_util import *
from k_line_dto import *
import matplotlib as mat
import numpy as np
import datetime as dt
import matplotlib.pyplot as plt
import time
stock_code = '600527.XSHG'
start_date = '20... | StarcoderdataPython |
11214587 | <reponame>hamroune/mlflow<filename>mlflow/mleap.py
"""
MLflow integration of the MLeap serialization tool for PySpark MLlib pipelines
This module provides utilities for saving models using the MLeap
using the MLeap library's persistence mechanism.
A companion module for loading MLFlow models with the MLeap flavor for... | StarcoderdataPython |
3297814 | <reponame>Bookiebookie/LieSpline
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, <NAME>, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redi... | StarcoderdataPython |
6643438 | import pytest
import yaml
from src.schemathesis.utils import StringDatesYAMLLoader
@pytest.mark.parametrize(
"value, expected",
(
("'1': foo", {"1": "foo"}),
("1: foo", {"1": "foo"}),
("1: 1", {"1": 1}),
("on: off", {"on": False}),
),
ids=["string-key-string-value", "i... | StarcoderdataPython |
120029 | import argparse
from typing import Optional, Dict, Type
from cpk.cli import AbstractCLICommand
from cpk.cli.commands.endpoint.info import CLIEndpointInfoCommand
from cpk.types import Machine, Arguments
_supported_subcommands: Dict[str, Type[AbstractCLICommand]] = {
"info": CLIEndpointInfoCommand,
}
class CLIEnd... | StarcoderdataPython |
11224309 | <reponame>gadomski/nexrad-l3<gh_stars>0
import unittest
import stactools.nexrad_l3
class TestModule(unittest.TestCase):
def test_version(self):
self.assertIsNotNone(stactools.nexrad_l3.__version__)
| StarcoderdataPython |
9677075 | <filename>model/attribute/net/models.py
import torch
from torch import nn
from torch.nn import init
from torchvision import models
from model.attribute.net.utils import ClassBlock
from torch.nn import functional as F
class Backbone_nFC(nn.Module):
def __init__(self, class_num, model_name='resnet50_nfc'):
... | StarcoderdataPython |
8106699 | # Copyright 2020 The Magenta 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
#
# Unless required by applicable law or agreed to in ... | StarcoderdataPython |
6466065 | '''Utilities for experimenting with the codes.
Assuming curve has all relevant data attached already.
'''
class Coding():
def __init__(self, curve):
self.c = curve
self.D = curve.D()
self.K = curve.K()
def get_k(self, C):
'''
Return the dimension of the code with given... | StarcoderdataPython |
371366 | def answer_type(request, json_list, nested):
for question in json_list:
if question['payload']['object_type'] == 'task_instance':
question['answer_class'] = 'task_answer'
| StarcoderdataPython |
226055 | <filename>rest_live/apps.py
from django.apps import AppConfig
class RestLiveConfig(AppConfig):
name = "rest_live"
| StarcoderdataPython |
11362938 | <filename>OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/EXT/histogram.py
'''OpenGL extension EXT.histogram
This module customises the behaviour of the
OpenGL.raw.GL.EXT.histogram to provide a more
Python-friendly API
Overview (from the spec)
This extension defines pixel operations that count occurenc... | StarcoderdataPython |
1991701 | <reponame>SkaarlK/Learning-Python
L = [1,3,5,7,9]
L2 = [2,4,6,8,10]
L3 = L + L2
print(L3) | StarcoderdataPython |
8196993 | import torch
from torch import nn
from models import tdl
BN_MOMENTUM = 0.1
class IdentityMapping(nn.Module):
def __init__(self, in_channels, out_channels, mode="per_channel"):
super(IdentityMapping, self).__init__()
self._mode = mode
self._setup_skip_conv(in_channels, out_channels)
self._setup_a... | StarcoderdataPython |
9704050 | <reponame>godontop/python-work
# coding=utf-8
import math
import sys
import pygame
pygame.init()
screen = pygame.display.set_mode([640, 480])
screen.fill([255, 255, 255])
plotPoints = []
for x in range(0, 640):
y = int(math.sin(x / 640.0 * 4 * math.pi) * 200 + 240)
plotPoints.append([x, y])
pygame.draw.line... | StarcoderdataPython |
3328598 | <gh_stars>1-10
from utils.sm_annotations import Annotation
from utils import uniprot
from needleman_wunsch import Align
def get_annotation(uniprot_ac_target, uniprot_ac_reference, nonconserved_color="r"):
"""
Annotate mutations of a target sequence relative to a reference
sequence. The alignment of the s... | StarcoderdataPython |
1691814 | import os,sys
from tkinter import *
import tkinter.font as font
from tkinter import filedialog
class Final(Frame):
def __init__(self, parent=None, pid=0,side=LEFT, anchor=N,wt=600,ht=400,is_next=True,is_back=True,next_frame=None,back_frame=None,info_txt="",path_frm=None,path_frm2=None,frames=[],fdict=[],prefix_v... | StarcoderdataPython |
1857696 | #!/bin/env python
# coding: utf-8
from base64 import b64encode
from httplib import HTTPConnection
from urlparse import urlparse
import os
import select
import socket
import sys
def main():
def exit_with_mesg(message, status=-1, color=31):
sys.stderr.write("\x1b[%sm%s\x1b[0m\n" % (color, message))
... | StarcoderdataPython |
5179954 | """
Tests for `txacme.challenges`.
"""
from operator import methodcaller
from acme import challenges
from acme.jose import b64encode
from hypothesis import strategies as s
from hypothesis import assume, example, given
from testtools import skipIf, TestCase
from testtools.matchers import (
AfterPreprocessing, Alway... | StarcoderdataPython |
167717 | from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from crispy_forms.layout import Layout, Field
from crispy_forms.bootstrap import (AppendedText)
from crispy_forms.helper import FormHelper
from .models import P... | StarcoderdataPython |
3504521 | choice = raw_input('Enjoying the course? (y/n)')
while choice != "y" or choice != "n":
if choice == "y" or choice == "n":#fill in the condition
print("pass")
break
else:
choice = raw_input("Sorry I didn't catch that. Enter again: ") | StarcoderdataPython |
6596960 | <gh_stars>1-10
import argparse
import wgenpatex
import model
import torch
parser = argparse.ArgumentParser()
parser.add_argument('target_image_path', help='paths of target texture image')
parser.add_argument('-w', '--patch_size', type=int,default=4, help="patch size (default: 4)")
parser.add_argument('-nmax', '--n_ite... | StarcoderdataPython |
3458649 | #!/usr/local/bin/python
# <NAME> | 05/29/2018
#|__This script requires Python 3.4 and modules - numpy & scipy
#|__extracts the quality string and determine the length and average quality score of each read
#|__Converts the raw values for each read set into descriptive statistics
#|__Provides descriptive stats for ... | StarcoderdataPython |
9643432 | <reponame>meganbkratz/neuroanalysis<gh_stars>1-10
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph.parametertree as pt
from scipy.ndimage import gaussian_filter
from ..filter import remove_artifacts, bessel_filter
class SignalFilter(QtCore.QObject):
"""A user-configurable signal fil... | StarcoderdataPython |
3371879 | from capitolweb.settings import *
ES_CW_INDEX = 'test-index'
| StarcoderdataPython |
8111267 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 Alibaba Group Holding Limited.
#
# 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/LI... | StarcoderdataPython |
8125248 | from geosolver.diagram.computational_geometry import distance_between_points, midpoint, cartesian_angle, \
signed_distance_between_cartesian_angles, arc_midpoint, line_length, arc_length
from geosolver.ontology.instantiator_definitions import instantiators
import numpy as np
__author__ = 'minjoon'
def label_dist... | StarcoderdataPython |
1683298 | <filename>captain/tlinject.py
import hmac
import hashlib
import base64
import binascii
import os
import time
import json
import sys
from datetime import datetime
import asyncpg
from tornado.web import RequestHandler
from .dispatch import route
from . import pageutils
def batches(iterable, groups_of=500):
if len... | StarcoderdataPython |
97337 | __source__ = 'https://leetcode.com/problems/guess-number-higher-or-lower-ii/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/guess-number-higher-or-lower-ii.py
# Time: O(n^2)
# Space: O(n^2)
#
# Description: Leetcode # 375. Guess Number Higher or Lower II
#
# We are playing the Guess Game. The game is as fo... | StarcoderdataPython |
3293903 | <filename>lib/galaxy/model/migrate/versions/0098_genome_index_tool_data_table.py
"""
Migration script to create the genome_index_tool_data table.
"""
from __future__ import print_function
import datetime
import logging
import sys
from sqlalchemy import Column, DateTime, ForeignKey, Integer, MetaData, String, Table
f... | StarcoderdataPython |
3475098 | <gh_stars>0
import random
import time
from datetime import datetime
from typing import Dict
from urllib.parse import urlsplit
import requests
# from fake_useragent import UserAgent
from requests import Response
class RequestsTimeout:
CONNECTION_TIMEOUT = 300
READ_TIMEOUT = 300
TIMEOUT_TUPLE = (CONNECTIO... | StarcoderdataPython |
6514926 | <gh_stars>0
from django.contrib import messages
from django.utils.translation import ugettext_lazy
GRAY = 'gray'
GREEN = 'green'
BLUE = 'blue'
YELLOW = 'yellow'
RED = 'red'
SUCCESS = ugettext_lazy('Success')
ERROR = ugettext_lazy('Error')
WARNING = ugettext_lazy('We are sorry')
errors_list = {
'title': {
... | StarcoderdataPython |
5051162 | <gh_stars>0
#!/usr/bin/env python3
# This file is Copyright (c) 2020 <NAME> <<EMAIL>>
# License: BSD
import os
import argparse
import sys
from migen import *
from migen.genlib.misc import WaitTimer
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_boards.platforms import colorlight_5a_75b
from l... | StarcoderdataPython |
11367893 | <filename>vespid/pipeline.py
# -*- coding: utf-8 -*-
import logging
import numpy as np
import pandas as pd
from tqdm import tqdm
from datetime import timedelta
from time import time
from joblib import dump as dump_obj, load as load_obj
from copy import copy, deepcopy
import os
import ray
import pathlib
from vespid imp... | StarcoderdataPython |
4992208 | type(Key.END)
sleep(1)
exit(0)
| StarcoderdataPython |
4942418 | <reponame>Jie-Re/GraphGallery<gh_stars>0
from .trainer import Trainer
from .registered_models import (TensorFlow, PyTorch, PyG,
DGL_PyTorch, DGL_TensorFlow,
Common,
MAPPING)
import graphgallery
from functools import partia... | StarcoderdataPython |
1964302 | #!/usr/bin/env python
"""
Name: structurama_from_genotypes.py
Author: <NAME>
Date: 11 July 2013
Convert genotype probabilities file output by Tom White's post-UNEAK processing scripts to input
file for structurama (Huelsenbeck and Andolfatto 2007).
Usage: python structurama_from_genotypes.py in_file out_file sa... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.