id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1751181 | # Generated by Django 2.0.7 on 2019-05-08 08:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app_user', '0002_auto_20190503_2141'),
]
operations = [
migrations.AlterField(
model_name='addr... | StarcoderdataPython |
3270100 | <filename>git_report.py
import pymsteams, requests
teams_webhook_url = "<< Insert Teams Webhook URL>>"
teams_git_repository_url = "<< Insert GitLab Repo URL (without .git) >>"
teams_git_repository_id = "<< Insert GitLab Repo ID >>"
teams_git_token = "<< Insert GitLab Access Token >>"
class Teams_Git(Plugin):
n... | StarcoderdataPython |
139272 | import hashlib, json
import nacl.bindings
from nacl import encoding
from nacl.utils import random
from .utils import to_hex, from_hex, is_hex, str_to_bytes
def create_address(pubkey):
if is_hex(pubkey):
pubkey = from_hex(pubkey)
h = hashlib.new('ripemd160')
h.update(pubkey)
return h.digest()... | StarcoderdataPython |
63497 | #########################################################################################
# Convert Jupyter notebook from Step 1 into Python script with a function called scrape
# that will execute all scraping code and return one Python dictionary containing
# all of the scraped data.
############################... | StarcoderdataPython |
4818792 | <reponame>ASTARCHEN/astartool
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: 河北雪域网络科技有限公司 A.Star
# @contact: <EMAIL>
# @site: www.snowland.ltd
# @file: imagehelper.py
# @time: 2019/6/27 4:16
# @Software: PyCharm
__author__ = 'A.Star'
import base64
import re
from io import BytesIO
from PIL import Image
d... | StarcoderdataPython |
42645 | import json
import requests
def analysis(password, path, title):
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from io import StringIO
print('Converi... | StarcoderdataPython |
186512 | <gh_stars>0
import os
import sys
import math
class Player:
VERSION = "DS.5.6.0"
testJSon = """{'community_cards': [],
'minimum_raise': 2,
'big_blind': 4,
'orbits': 0,
'in_action': 3,
'bet_index': 2,
'current_buy_in': 4,
'round': 0,
'players': [{'id': 0, 'bet': 0, 'version': 'Pony 1.0.0', 'time_used': ... | StarcoderdataPython |
56697 | """ NOTICE: A Custom Dataset SHOULD BE PROVIDED
Created: May 02,2019 - <NAME>
Revised: May 07,2019 - <NAME>
"""
import os
import numpy as np
from PIL import Image
import torchvision.transforms as transforms
import inception_preprocessing
from torch.utils.data import Dataset
__all__ = ['CustomDataset']
config = {
... | StarcoderdataPython |
196566 | """
Given a sequence originalSeq and an array of sequences, write a method to find if originalSeq can be uniquely
reconstructed from the array of sequences.
Unique reconstruction means that we need to find if originalSeq is the only sequence such that all sequences in
the array are subsequences of it.
Example 1:
In... | StarcoderdataPython |
99551 | #!/usr/bin/env python3
#### Intro to Python and Jupyter Notebooks ####
#### Before class ####
# share URL to hack.md
# check installation of python and jupyter notebooks
#### Welcome ####
# instructor introduction
# overview of fredhutch.io
# sign in
# learner introductions and motivation
# overview course philos... | StarcoderdataPython |
3352802 | <gh_stars>0
from .utils import sorted_by_key
def stations_level_over_threshold(stations, tol):
"""
Function that returns a list of (station, tol) tuples with stations
at which the latest relative water level is over tol.
Inputs
------
stations: list of MonitoringStation objects
tol ... | StarcoderdataPython |
3366253 | <reponame>cajfisher/vasppy<gh_stars>10-100
from lxml import etree # type: ignore
from typing import List, Union, Optional, Any, Dict
from pymatgen.core import Structure # type: ignore
import numpy as np # type: ignore
def parse_varray(varray: etree.Element) -> Union[List[List[float]],
... | StarcoderdataPython |
1715497 | r"""Test :py:class:`lmp.model` signature."""
import inspect
from lmp.model import LSTMModel, RNNModel
def test_class():
r"""Ensure class signature."""
assert inspect.isclass(LSTMModel)
assert not inspect.isabstract(LSTMModel)
assert issubclass(LSTMModel, RNNModel)
def test_class_attribute():
r... | StarcoderdataPython |
3233228 | <gh_stars>0
# Copyright (c) 2011-2013 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD License found in README.md.
from django.db import models
class Conference(models.Model):
session = models.PositiveSmallIntegerField(default=0)
start_date = models.DateField()
end_... | StarcoderdataPython |
3240603 | from typing import List, Any
class BaseModule(object):
def __init__(self):
pass
def tick(self, lines: List[Any]):
pass
| StarcoderdataPython |
1780803 | <filename>examples/fre/compare_2_scheduling.py
'''
Interactively explore the difference between two schedules of the same trace.
Usage:
compare_2_scheduling.py <swf_file1> <swf_file2> [-h]
Options:
-h --help show this help message and exit.
'''
import matplotlib
matplotlib.use('Qt5Agg')
from matplot... | StarcoderdataPython |
3201379 | <reponame>lzmaths/leetcode
class Solution(object):
def minTotalDistance(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
rows = []
cols = []
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j] == 1:
... | StarcoderdataPython |
1630539 | <gh_stars>0
# https://zhuanlan.zhihu.com/p/33593039
# Syntax of list comprehension(列表解析):
# result = [do_something_with(item) for item in item_list]
# Same way to get a generator:
# result = (do_something_with(item) for item in item_list)
# ============================================================
# Modifying a ... | StarcoderdataPython |
3383540 | #coding: utf-8
# thanks to GNQG/lr2irproxy for the original source code of DPISocket
# github: https://github.com/GNQG/lr2irproxy
# still not sure the necessity and detailed contents of this class
import socket
from httplib import HTTPMessage, HTTPResponse
from StringIO import StringIO
from zlib import decompress
im... | StarcoderdataPython |
19470 | import os
from argparse import ArgumentParser
from pathlib import Path
from general_utils import split_hparams_string, split_int_set_str
# from tacotron.app.eval_checkpoints import eval_checkpoints
from tacotron.app import (DEFAULT_MAX_DECODER_STEPS, continue_train, infer,
plot_embeddings, t... | StarcoderdataPython |
90434 | # Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php or see LICENSE file.
# Copyright 2007-2008 <NAME> <<EMAIL>>
""" Facilities for python properties generation.
"""
def gen_property_with_default(name, fget=None, fset=None, doc=""):
""" Generates a property of a name either with a de... | StarcoderdataPython |
4838618 | <filename>src/agimus/path_execution/play_path.py
#!/usr/bin/env python
# Copyright 2018 CNRS Airbus SAS
# Author: <NAME>
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain ... | StarcoderdataPython |
3345987 | # # -*- coding: utf-8 -*-
# # Import Python libs
# from __future__ import absolute_import
# # Import Salt Testing libs
# from tests.support.unit import skipIf, TestCase
# from tests.support.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch
# # Import salt libs
# import salt.modules.cyg as cyg
# cyg.__salt__ = {... | StarcoderdataPython |
133590 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2016 pocsuite developers (https://seebug.org)
See the file 'docs/COPYING' for copying permission
"""
import sys
from pocsuite_cli import pcsInit
from .lib.core.common import banner
from .lib.core.common import dataToStdout
from .lib.core.settings im... | StarcoderdataPython |
139639 | <filename>pyp.py
#!/usr/bin/env python3
import argparse
import ast
import importlib
import inspect
import itertools
import os
import sys
import textwrap
import traceback
from collections import defaultdict
from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, cast
__all__ = ["pypprint"]
__version__ = "0.... | StarcoderdataPython |
128665 | # -------------------------------------------------------------------------
# Copyright (c) PTC Inc. and/or all its affiliates. All rights reserved.
# See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# User Management Example - ... | StarcoderdataPython |
65192 | <gh_stars>1-10
def verify(f_d, sol, num_frags):
count = 0
for i in range(1, len(sol)):
l = sol[:i]
r = sol[i:]
if not l in f_d and not r in f_d:
continue
if l in f_d and r in f_d:
if f_d[l] != f_d[r]:
return False
count += (2*f_d[l] if l != r else f_d[l])
else:
r... | StarcoderdataPython |
104765 | <reponame>kampelmuehler/synthesizing_human_like_sketches
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from collections import namedtuple
class PSim_Alexnet(nn.Module):
def __init__(self, num_classes=125, train=True, with_classifier=False):
super(PSim_Alexnet, self).__init__()
... | StarcoderdataPython |
1698313 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""API鉴权相关代码"""
from functools import wraps
from executor.common.constant import Roles
from executor import exceptions
def enforce(required=Roles.guest):
"""
校验身份用户身份的Handler装饰器,默认是Guest权限,若权限不足则直接返回401
"""
assert Roles.contains(required)
def wrap(ha... | StarcoderdataPython |
4825227 | #! /usr/bin/env py.test
from __future__ import print_function
import os
import sys
import time
from qs import proc
def test_run_cmd_with_this():
st, out = proc.run_cmd([sys.executable, "-c", "import this"])
assert "Namespaces are one honking great idea -- let's do more of those!" in out
def test_run_cmd_t... | StarcoderdataPython |
11713 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('activity_log', '0003_activitylog_extra_data'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
3258710 | # -*- coding: utf-8 -*-
import pytest
import concierge.core.exceptions as exceptions
import concierge.core.lexer as lexer
def make_token(indent_lvl=0):
token_name = "a{0}".format(0)
return lexer.Token(indent_lvl, token_name, [token_name], token_name, 0)
@pytest.mark.parametrize(
"input_, output_", (... | StarcoderdataPython |
3259226 | from flask import Flask, g
from src.model.databaseHandler import ModelDatabase
from flask_socketio import SocketIO
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app, async_mode="gevent")
# Prevent the spam of death
import logging
log = logging.getLogger('werkzeug')
log.setLevel(loggin... | StarcoderdataPython |
170360 | import tensorflow as tf
slim = tf.contrib.slim
from helper_net.inception_v4 import *
import pickle
import numpy as np
def get_weights():
checkpoint_file = '../checkpoints/inception_v4.ckpt'
sess = tf.Session()
arg_scope = inception_v4_arg_scope()
input_tensor = tf.placeholder(tf.float32, (None, 299, 299, 3))
with... | StarcoderdataPython |
3342273 | <filename>python/caty/core/camb/__init__.py
# coding: utf-8
def create_bindings(action_fs, app):
from caty.core.camb.parser import BindingParser, LiterateBindingParser
from caty.core.camb.binding import ModuleBinderContainer
from caty.core.language.util import remove_comment
if app._no_ambient:
... | StarcoderdataPython |
114026 | #!/usr/bin/env python
"""
wiggletools_commands.py
<NAME> / December 15, 2015
Writes wiggletools commands for computing mean bigwigs by tissue. Each set
of commands is numbered. They should be executed in order; some commands
in successive files depend on commands from previous files.
"""
import gzip
from collections i... | StarcoderdataPython |
17769 | from pathlib import Path
from toolz import itertoolz, curried
import vaex
transform_path_to_posix = lambda path: path.as_posix()
def path_to_posix():
return curried.valmap(transform_path_to_posix)
transform_xlsx_to_vaex = lambda path: vaex.from_ascii(path, seperator="\t")
def xlsx_to_vaex():
return curr... | StarcoderdataPython |
141529 | #!/usr/bin/env python3
a, b, n = map(int, input().split())
x = min(b-1, n)
print(a*x//b - a*(x // b)) | StarcoderdataPython |
3251998 | from polyphony import testbench
def if10(x, y, z):
if x == 0:
if y == 0:
z = 0
elif y == 1:
z = 1
else:
z = 2
elif x == 1:
z = 1
else:
z = 2
return z
@testbench
def test():
assert 0 == if10(0, 0, 1)
assert 1 == if10(0... | StarcoderdataPython |
3259571 | <reponame>Gugush284/get<filename>5_lab/5-2-adc-sar.py<gh_stars>0
import RPi.GPIO as GPIO
import time
dac = [26, 19, 13, 6, 5, 11, 9, 10]
comp = 4
troyka = 17
maxVolt = 3.3
GPIO.setmode(GPIO.BCM)
GPIO.setup(dac, GPIO.OUT, initial = 0)
GPIO.setup(troyka, GPIO.OUT, initial = 1)
GPIO.setup(comp, GPIO.IN)
def adc():
... | StarcoderdataPython |
4836867 | # Copyright 2019 Cortex Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | StarcoderdataPython |
54904 | <filename>log/urls.py
from django.conf.urls import url, include
from . import views
from django.contrib.auth import views as auth_views
app_name = 'log'
urlpatterns = [
url(r'^login/$', views.login_view, name='login_url'),
url(r'^logout/$', views.logout_view, name='logout_url'),
]
| StarcoderdataPython |
3310458 | import sys
import pickle
from preprocessing.simplesrl import read_simplesrl
class LabeledData(object):
def __init__(self):
self.data = [[], []]
def getData(self):
return self.data
def getSentences(self):
return self.data[0]
def getLabels(self):
return self.data[1]
... | StarcoderdataPython |
66278 | # PyQt5 modules
from PyQt5.QtGui import QColor, QPainter, QRadialGradient, QBrush
from PyQt5.QtCore import Qt, QTimer, QSize, pyqtSlot, pyqtProperty
from PyQt5.QtWidgets import QWidget, QApplication
class LedWidget(QWidget):
def __init__(self, parent=None):
super(LedWidget, self).__init__(parent)
... | StarcoderdataPython |
1620341 | <filename>addon_common/common/functools.py
'''
Copyright (C) 2021 CG Cookie
http://cgcookie.com
<EMAIL>
Created by <NAME>, <NAME>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either v... | StarcoderdataPython |
1605661 | #!/usr/bin/env python3
import json
import pdb
import csv
from collections import OrderedDict
import os.path
from pathlib import Path
from datetime import datetime
import re
import pandas as pd
import sys
import settings
import scrape_schedule
def CalcPercent(total, skip, correct):
try:
return round(corr... | StarcoderdataPython |
3383637 | import enum
class NTStatus(enum.Enum):
STATUS_SUCCESS = 0x00000000
STATUS_WAIT_0 = 0x00000000
STATUS_WAIT_1 = 0x00000001
STATUS_WAIT_2 = 0x00000002
STATUS_WAIT_3 = 0x00000003
STATUS_WAIT_63 = 0x0000003F
STATUS_ABANDONED = 0x00000080
STATUS_ABANDONED_WAIT_0 = 0x00000080
STATUS_ABANDONED_WAIT_63 = 0x000000BF
S... | StarcoderdataPython |
3201691 | <filename>Beginner/8/primeNumberChecker.py
# EXERCISE 2 : Prime Number Checker
def prime_checker(number):
is_prime = True
if number<=1:
is_prime = False
for i in range(2,number):
if i*i > number:
break
if number%i==0:
is_prime = False
break
if... | StarcoderdataPython |
4821053 | <filename>yatube/posts/migrations/0009_remove_post_group.py
# Generated by Django 2.2.19 on 2022-03-27 12:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0008_auto_20220327_1713'),
]
operations = [
migrations.RemoveField(
... | StarcoderdataPython |
68538 | # Generated by Django 2.0.5 on 2018-05-22 14:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0009_auto_20180522_1409'),
]
operations = [
migrations.AlterModelOptions(
name='contactnumbers',
options={'verbose_n... | StarcoderdataPython |
3394490 | <filename>tests/test_base_model.py
#!/usr/bin/python3
"""test for BaseModel"""
import unittest
import os
from models.base_model import BaseModel
import pep8
class TestBaseModel(unittest.TestCase):
"""base model"""
@classmethod
def setclass(cls):
"""setup for the test"""
cls.base = BaseMod... | StarcoderdataPython |
91659 | <gh_stars>10-100
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import qdarkstyle
from PyQt5.QtSql import *
import hashlib
class SignUpWidget(QWidget):
student_signup_signal = pyqtSignal(str)
def __init__(self):
super().__init__()
self.setUpUI()
... | StarcoderdataPython |
1696726 | import contextlib
import six
@contextlib.contextmanager
def open_filename(*args, **kwargs):
"""A context manager for open(..) for a filename OR a file-like object."""
if isinstance(args[0], six.string_types):
with open(*args, **kwargs) as fh:
yield fh
else:
yield args[0]
... | StarcoderdataPython |
6661 | <gh_stars>1-10
'''
Created on 2011-6-22
@author: dholer
'''
| StarcoderdataPython |
3302121 | <gh_stars>1-10
from django.template.defaultfilters import date as _date
from django.utils.translation import get_language, ugettext_lazy as _
def daterange(df, dt):
lng = get_language()
if lng.startswith("de"):
if df.year == dt.year and df.month == dt.month:
return "{}.–{}".format(_date(d... | StarcoderdataPython |
3326306 | from typing import Any, Dict
from flask import Flask, current_app
from pynamodb.connection import Connection
from flask_pynamodb.model import Model as ModelClass
__version__ = "0.0.2"
DYNAMODB_SETTINGS = (
"DYNAMODB_REGION",
"DYNAMODB_HOST",
"DYNAMODB_CONNECT_TIMEOUT_SECONDS",
"DYNAMODB_READ_TIMEOU... | StarcoderdataPython |
4829556 | <gh_stars>1-10
import json
import requests
from django.db import models
from django.contrib.auth.models import User
from .utils import *
#
# 1: 'ece-1',
# 2: 'ece-2',
# 3: 'mse-1',
# 4: 'pas-1',
# 5: 'pas-2',
# 6: 'osc-1',
# 7: 'osc-2',
# 8: 'osc-3',
# 9: 'osc-4',
# 10: 'osc-5',
# 11: 'bio-1',
# 12: 'bio-2',
# 13: 'b... | StarcoderdataPython |
3284866 | <reponame>Eyalcohenx/tonic
import abc
class Agent(abc.ABC):
'''Abstract class used to build agents.'''
def initialize(self, observation_space, action_space, seed=None):
pass
@abc.abstractmethod
def step(self, observations):
'''Returns actions during training.'''
pass
def... | StarcoderdataPython |
1749952 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright 2017 ROBOTIS CO., LTD.
#
# 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 cop... | StarcoderdataPython |
183474 | <reponame>LandRegistry/audit<gh_stars>0
import os, sys
from flask import Flask
app = Flask(__name__)
# add config
app.config.from_object('config')
if not os.environ.get('REDIS_URL'):
print "REDIS_URL not set. Using default=[%s]" % app.config['REDIS_URL']
if not os.environ.get('REDIS_NS'):
print "REDIS_NS no... | StarcoderdataPython |
1690977 | <reponame>kevinksyTRD/pyCOSIM
import os
import random
import numpy as np
import pandas
import pytest
from pyOSPParser.logging_configuration import OspLoggingConfiguration
from pyOSPParser.scenario import OSPScenario, OSPEvent
from pycosim.osp_command_line_interface import get_model_description, run_single_fmu, \
... | StarcoderdataPython |
1734595 | from typing import List, Optional, Set
from numpy import ndarray
from livia.process.analyzer.object_detection.DetectedObject import DetectedObject
class FrameObjectDetection:
def __init__(self, frame: ndarray, objects: List[DetectedObject], class_names: Optional[Set[str]] = None):
self.__frame: ndarray ... | StarcoderdataPython |
172030 | <gh_stars>1-10
"""Custom logging module wrapping standard logging, but with special pyindigoConfig.
It mostly serves debug purposes, logging low-level stuff like property events.
See https://docs.python.org/3/howto/logging.html for info on basic logging
Example use:
>>> import pyindigo.logging as logging
>>> logging.... | StarcoderdataPython |
3387459 | <gh_stars>0
import datetime
import os
import socket
import sys
import time
from urllib.parse import quote, unquote
from library import (
magic,
html
)
from threading import Thread
LOG = "./servidor.log"
DIRECTORYINDEX = "index.html"
def escrever_log(msg):
with open(LOG, 'a') as f:
f.write(ms... | StarcoderdataPython |
1744662 | <filename>code/ui/mainWindow.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainWindow.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 know what you are doin... | StarcoderdataPython |
5520 | <reponame>scottwedge/OpenStack-Stein
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://ww... | StarcoderdataPython |
86010 | <reponame>vdonnefort/lisa
#! /usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2018, ARM Limited and contributors.
#
# 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
#... | StarcoderdataPython |
3287225 | import os
import shutil
path = '/Users/zac/Downloads/zip/'
def scan_file():
files = os.listdir(path)
for f in files:
if f.endswith('.zip'):
print("ZacLog: Found zip file!")
return f
def unzip_file(f):
folder_name = f.split('.')[0]
target_path = path + folder_name
... | StarcoderdataPython |
48927 | # -*- coding: utf-8 -*-
# Program Name: coin_conversion.py
# <NAME>
# 06/15/16
# Python Version 3.4
# Description: Convert amount into coins
# Optional import for versions of python <= 2
from __future__ import print_function
# Do this until valid input is given
while True:
try:
# This takes in a integer
coins ... | StarcoderdataPython |
1785578 | #!/usr/bin/python
DOCUMENTATION = '''
---
module: ec2_asg_target_groups
short_description: Configure target groups on an existing auto scaling group
description:
- Configure the specified target groups to be attached to an auto scaling group
- The auto scaling group must already exist (use the ec2_asg module)
ver... | StarcoderdataPython |
3224957 | from abc import ABC
from src import OrderDetails
class DatabaseInterface(ABC):
async def add_order(self, size: OrderDetails.PizzaSizes, payment: OrderDetails.PaymentTypes):
pass
class MessageSenderInterface(ABC):
async def send_message(self, msg: str, buttons=None):
pass
def end_dialog... | StarcoderdataPython |
3385176 | import unittest
from random import randint
from pytime.clock_in_mirror import what_is_the_time
class ClockTestCases(unittest.TestCase):
def test_2(self):
self.assertEqual(what_is_the_time("06:35"), "05:25", "didn't work for '06:35'")
def test_3(self):
self.assertEqual(what_is_the_time("11:59... | StarcoderdataPython |
3329563 | <reponame>jsalbert/biotorch
import pytest
@pytest.fixture(scope='session')
def model_architectures():
# Tuple containing (architecture, input size)
return [
('le_net_mnist', (1, 1, 32, 32)),
('le_net_cifar', (1, 3, 32, 32)),
('resnet18', (1, 3, 128, 128)),
('resnet20', (1, 3, 1... | StarcoderdataPython |
1626535 | """Refresh a duplicate volume with a snapshot from its parent."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
@click.command()
@click.argument('volume_id')
@click.argument('snapshot_id')
@environment.pass_env
def cli(env, volume_id, snapshot_id):... | StarcoderdataPython |
128290 | <gh_stars>100-1000
p = 196732205348849427366498732223276547339
secret = REDACTED
def calc_root(num, mod, n):
f = GF(mod)
temp = f(num)
return temp.nth_root(n)
def gen_v_list(primelist, p, secret):
a = []
for prime in primelist:
a.append(calc_root(prime, p, secret))
return a
def decodeI... | StarcoderdataPython |
1652698 | <reponame>liquidity-network/nocust-hub
from .subscribe import (
subscribe,
unsubscribe,
)
from .ping import (
ping,
)
from .get import (
get,
)
OPERATIONS = {
'subscribe': subscribe,
'unsubscribe': unsubscribe,
'ping': ping,
'get': get,
}
| StarcoderdataPython |
3210349 | <reponame>shreshthtuli/Go-Back-N
"""
Mininet Topologies with 2 nodes
Author : <NAME>
Usage:
- sudo mn --custom topo.py --topo linear --controller=remote,ip=127.0.0.1
To specify parameters use: --link tc,bw=10,delay=3,loss=2,max_queue_size=3
Example : for ring topology with bandwidth limited to 2:
- sudo mn --... | StarcoderdataPython |
14907 | <gh_stars>1-10
from fumblr.keys import IMGUR_SECRET, IMGUR_ID
from imgurpython import ImgurClient, helpers
import os
import base64
API_URL = 'https://api.imgur.com/3/'
def get_client():
"""
Get an API client for Imgur
Returns:
Imgur client if it is available
"""
try:
return Imgur... | StarcoderdataPython |
40127 | # -*- coding: utf-8 -*-
from .gmail import GmailPlugin
| StarcoderdataPython |
148249 | <filename>apps/groups/views.py<gh_stars>0
from rest_framework import viewsets
from django.contrib.auth.models import Group
from rest_framework.authentication import SessionAuthentication
from rest_framework_simplejwt.authentication import JWTAuthentication
from rest_framework.permissions import IsAuthenticatedOrReadOnl... | StarcoderdataPython |
3326393 | # _ __ ____ _ _
# | |/ / | _ \ | \ | |
# | ' / | |_) | | \| |
# | . \ | __/ | |\ |
# |_|\_\ |_| |_| \_|
#
# (c) 2018 KPN
# License: MIT license.
# Author: <NAME>
#
# include all
from .senml_base import SenmlBase
from .senml_pack import SenmlPack
from .senml_record import SenmlRecord
from .senml... | StarcoderdataPython |
1607827 | <filename>tests/native/test_armv7_bitwise.py
import unittest
from manticore.native.cpu import bitwise
class BitwiseTest(unittest.TestCase):
_multiprocess_can_split_ = True
def test_mask(self):
masked = bitwise.Mask(8)
self.assertEqual(masked, 0xFF)
def test_get_bits(self):
val =... | StarcoderdataPython |
1794719 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from gdcmdtools.perm import GDPerm
from gdcmdtools.perm import help_permission_text
import argparse
from argparse import RawTextHelpFormatter
from gdcmdtools.base import BASE_INFO
from gdcmdtools.base import DEBUG_LEVEL
from pprint import pprint
import sys
import loggin... | StarcoderdataPython |
3331797 | <reponame>dexbiobot/SML-Cogs
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limit... | StarcoderdataPython |
1707521 | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
df1 = pd.read_csv("original-benchmark-results.csv")
df2 = pd.read_csv("warped-benchmark-results.csv")
mean... | StarcoderdataPython |
1792779 | # Copyright (c) 2012 - 2015 <NAME>, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import sys
import time
import subprocess
from jenkinsflow.test.cfg import ApiType
from jenkinsflow.test.framework import api_select
from jenkinsflow.test.framework.logger import log, logt
def _a... | StarcoderdataPython |
199469 | <filename>bitcashcn/network/transaction.py
from bitcashcn.utils import is_valid_hex, asm_to_list
class Transaction:
"""Represents a transaction returned from the network."""
__slots__ = ('txid', 'amount_in', 'amount_out', 'fee', 'inputs', 'outputs')
def __init__(self, txid, amount_in, amount_out):
... | StarcoderdataPython |
1767013 | import spira.all as spira
class Resistor(spira.PCell):
width = spira.NumberParameter(default=spira.RDD.R1.MIN_WIDTH, doc='Width of the shunt resistance.')
length = spira.NumberParameter(default=spira.RDD.R1.MIN_LENGTH, doc='Length of the shunt resistance.')
def validate_parameters(self):
if self... | StarcoderdataPython |
112852 | import copy
import os
import re
from gen_code_util import build_call_line
TARGET_FILES_SWIG = [
'iriclib_bc.h',
'iriclib_cc.h',
'iriclib_complex.h',
'iriclib_geo.h',
'iriclib_geoutil.h',
'iriclib_grid.h',
'iriclib_grid_solverlib.h',
'iriclib_gui_coorp.h',
'iriclib_init.h',
'iriclib_not_withbaseid.... | StarcoderdataPython |
1649557 | import os
import sys
import warnings
from inspect import getmembers, isfunction
import inspect
import numpy as np
from ase.io import read
import scipy.sparse as sp
from Utilities import Initial
no_dir_template = "\nThere does not exist a suitable directory in which to place these" \
"quantities.\n\nInstead, we sh... | StarcoderdataPython |
164248 | """
Run main.
"""
from behave_graph import main
main()
| StarcoderdataPython |
141140 | <filename>tests/test_ilcs.py
import numpy
def test_all_distances(ilcs):
numpy.testing.assert_almost_equal(
ilcs.comparator('125 55/21-a (att)', '126 55/21-b (att)'),
numpy.array([
1, # citation: Not Missing
0, # ambiguous: Dummy
1, # same name type?: Dummy
... | StarcoderdataPython |
161891 | <gh_stars>0
# coding: utf-8
# In[1]:
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
import time
from bs4 import BeautifulSoup
#driver=webdriver.PhantomJS(executable_path="")
driver=webdriver.Chrome(executable_path="")
driver.get("https://tw.news.yahoo.com/technology/archi... | StarcoderdataPython |
1636465 | #! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... | StarcoderdataPython |
3214461 | <gh_stars>10-100
# The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation... | StarcoderdataPython |
34717 | <filename>setup_project.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup_project.py -- GIS Project Setup Utility
<NAME>; May 2014/May 2016
This script creates a project folder-environment for GIS projects as follows:
<project_name>/
data/
raw/
<project_name>.gdb
design/
fonts/... | StarcoderdataPython |
118277 | from sklearn.naive_bayes import BernoulliNB
from run_binary_classifier import run
param_grid = {
'bag_of_words__stop_words': ['english'],
'bag_of_words__ngram_range': [(1, 2)],
'bag_of_words__max_features': [500],
'dim_reduct__n_components': [300],
'normalizer__norm': ['l2'],
... | StarcoderdataPython |
3242074 | import matplotlib.pyplot as plt
import numpy as np
from lib.plot_utils import plot_all_states, plot_agent, plot_value_table, plot_env_agent_and_policy_at_state, \
plot_env_agent_and_chosen_action, plot_policy
from lib.grid_world import a_index_to_symbol
class TDEvaluation:
def __init__(self, env, policy, ini... | StarcoderdataPython |
1675564 | <filename>models/language_modeling/tensorflow/bert_large/training/fp32/generic_ops.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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... | StarcoderdataPython |
82681 | import sys
sys.path.append('..')
from troup.client import CommandAPI, client_to_local_node, ChannelClient
#cc = ChannelClient(nodes_specs=['RPI:ws://192.168.2.128:7000'])
cc = client_to_local_node()
cmd = CommandAPI(channel_client=cc)
promise = cmd.send(CommandAPI.command('info', {}))
print(promise)
print('cmd sen... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.