id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1641712 | <filename>tests/tempdiskimage.py
""" Create a temporary disk image on MacOS """
import pathlib
import platform
import subprocess
import tempfile
import time
class TempDiskImage:
""" Create and mount a temporary disk image """
def __init__(self, size=100, prefix=None):
""" Create and mount a temporar... | StarcoderdataPython |
1629106 | <gh_stars>0
def exec_programmable_source(file, **kwargs):
"""Execute file using kwargs
Execute a script that sets a local variable kwargs and then
executes the given file. The file that is executed calls the
function that creates a programmable source using the given kwargs.
"""
import os
import sys
i... | StarcoderdataPython |
1669428 | from onegov.core.orm import Base
from onegov.core.orm.mixins import TimestampMixin
from onegov.core.orm.types import UUID
from onegov.pay import PayableManyTimes
from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Numeric
from sqlalchemy import Text
from... | StarcoderdataPython |
3342021 | <filename>modeling/test_components.py<gh_stars>1-10
"""
Tests for components.
"""
# Copyright (c) 2019 <NAME>. All rights reserved.
import numpy as np
import trimesh
from modeling import components, view
FULL = 2.0 * np.pi
DEBUG_VISUALIZE = False
def test_curved_plate():
"""test for curved_plate"""
su... | StarcoderdataPython |
1719942 | <reponame>cristian-rincon/vote-app
from django.contrib import admin
from .models import Choice, Question
# Register your models here.
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
@admin.register(Question)
class QuestionAdmin(admin.ModelAdmin):
list_display = ("question_text", "pub... | StarcoderdataPython |
3226769 | <gh_stars>1-10
#!/usr/bin/env python
"""
Usage: thingpin -h
thingpin [options] run
thingpin create-config
thingpin [options] install-service
Monitor GPIO pins and update AWS IoT via MQTT.
Arguments:
run run the thingpin monitor
create-config generate sample YAML thingpin-... | StarcoderdataPython |
1604481 | <reponame>juanmcasillas/pyGLLib
#!/usr/bin/env python3
# ///////////////////////////////////////////////////////////////////////////
#
# pyCubeText.py
# trying to load a texture in the cube.
# <NAME> <<EMAIL>>
#
# ///////////////////////////////////////////////////////////////////////////
import pyGLLib
import glm
imp... | StarcoderdataPython |
3308427 | from sqlalchemy import create_engine, Table, Column, Integer, String, MetaData, ForeignKey, DateTime, UniqueConstraint,\
or_, Boolean
from sqlalchemy.orm import mapper, sessionmaker, aliased
from datetime import datetime
from common.constants import CLIENT_DB_PREFIX
class ClientBase:
"""Client database for th... | StarcoderdataPython |
1759686 | <reponame>jonseddon/primavera-dmt
#!/usr/bin/env python
"""
create_esgf_retrieval.py
This script is used to create a retrieval request from the
`rose_task_names_new.json` file generated by `make_rose_task_names.py`.
"""
import argparse
import datetime
import json
import logging.config
import sys
import django
django.... | StarcoderdataPython |
4818502 | <reponame>Smattr/no
#!/usr/bin/env python3
import os
import subprocess
import tempfile
import unittest
class Test(unittest.TestCase):
def test_allow_network(self):
'''
test --allow-network
'''
# first check if we can lookup example.com when uninstrumented
try:
subprocess.check_call(['nsl... | StarcoderdataPython |
3228725 | <gh_stars>1-10
from setuptools import setup
setup(
name='opencv_draw_annotation',
version='0.1.1',
author='<NAME>',
author_email='<EMAIL>',
packages=['opencv_draw_annotation'],
scripts=[],
url='https://github.com/SethPipho/opencv-draw-annotation',
license='MIT',
description='A libra... | StarcoderdataPython |
3302831 | <gh_stars>0
f = float(input("Input a measurement in feet : "))
i = f*12
y = f/3
m = f*0.000189394
print("Do conversion")
print("in Inches : %3.2f" % i)
print("in Yards : %3.2f" % y)
print("in Miles : %3.2f" % m)
| StarcoderdataPython |
1600859 | <filename>garpar/core/portfolio.py
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, <NAME>, <NAME> and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE
from collections.abc import Mapping
import attr
from attr ... | StarcoderdataPython |
1656657 | #密码和密匙
Code = "85E813540F0AB405"
Key = "<KEY>"
#置换选择1
PC_1 = [57,49,41,33,25,17,9, 1,58,50,42,34,26,18, 10,2,59,51,43,35,27, 19,11,3,60,52,44,36, 63,55,47,39,31,23,15, 7,62,54,46,38,30,22, 14,6,61,53,45,37,29,
21,13,5,28,20,12,4]
#置换选择2
PC_2 = [14,17,11,24,1,5, 3,28,15,6,21,10, 23,19,12,4,26,8, 16,7,27,20,13,2, 41,52... | StarcoderdataPython |
1652370 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 21 17:16:33 2018
@author: <NAME>
"""
import math
import numpy as np
from numba import float64, guvectorize, cuda
@guvectorize([(float64[:], float64, float64[:], float64[:, :], float64[:], float64[:])], '(n), (), (n), (n, m), (m)->(n)', target='cuda... | StarcoderdataPython |
1625100 | #!/usr/bin/env python
import capnp
import catrank_capnp
from common import rand_int, rand_double, rand_bool, WORDS
from random import choice
from string import ascii_letters
try:
# Python 2
from itertools import izip
except ImportError:
izip = zip
class Benchmark:
def __init__(self, compression):
... | StarcoderdataPython |
1719687 | # Copyright (c) 2019, IRIS-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the foll... | StarcoderdataPython |
92589 | import unittest
from user import User
class UserTest(unittest.TestCase):
"""
Test class that defines test cases for the contact class behaviours.
Args:
unittest.TestCase : Inherits the testCase class that helps in creating test cases
"""
def setUp(self):
"""
Set up method ... | StarcoderdataPython |
1698698 | #!/bin/python3
def surfaceArea(A):
# The function is expected to return an INTEGER.
# The function accepts 2D_INTEGER_ARRAY A as parameter.
area = 0
height = len(A)
width = len(A[0])
# Step 1. Top and bottom
area += sum(2 for row in A for n in row if n > 0)
# Step 2. For each level, ... | StarcoderdataPython |
3345701 | from setuptools import setup, find_packages
from codecs import open
from os import path
import AxonDeepSeg
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
req_path = path.join(here, 'requirements.txt')
with open(req_path, "... | StarcoderdataPython |
119558 | from enum import Enum
from reconstruction.network import AE, SpiralDeblock, SpiralEnblock, Pool
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_scatter import scatter_add
from conv import SpiralConv, GatedSpiralConv
class SkipAE(nn.Module):
def __init__(self, in_channels, out_chann... | StarcoderdataPython |
3285481 | <reponame>EricRemmerswaal/tensorflow
# Copyright 2020 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/LICEN... | StarcoderdataPython |
25174 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2018 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import collections
import math
import numpy as np
def count_words(filename):
counter = collections.Counter()
wi... | StarcoderdataPython |
98241 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ~~~~~~~~~~~~~~IMPORTS~~~~~~~~~~~~~~ #
# Standard library imports
import argparse
# Local imports
import NanoCount as pkg
from NanoCount.NanoCount import NanoCount as nc
from NanoCount.common import *
# ~~~~~~~~~~~~~~MAIN PARSER ENTRY POINT~~~~~~~~~~~~~~ #
def main(... | StarcoderdataPython |
171882 | """
Report module
"""
import os
import os.path
import sys
from .models import Models
from .query import Query
class Report(object):
"""
Methods to build reports from a series of queries
"""
@staticmethod
def write(output, line):
"""
Writes line to output file.
Args:
... | StarcoderdataPython |
3366192 | <reponame>NastyaTataurova/pix2pix_pytorch<filename>crs/model/discriminator.py
import torch
import torch.nn as nn
class discriminator(nn.Module):
def __init__(self):
super().__init__()
self.conv0 = nn.Sequential(
nn.Conv2d(3 * 2, 64, kernel_size=4, stride=2, padding=1, padding_mode="reflect"),
... | StarcoderdataPython |
3380415 | <gh_stars>0
__all__ = ["UserTuple", "DocValue", "DocDict"]
from copy import copy, deepcopy
from typing import Sequence, Union, Iterable
from wrapt import ObjectProxy
from wrapt.wrappers import _ObjectProxyMetaType # noqa
class DeviceDataFilter:
"""`DeviceDataFilter` represents the conditions for reading device ... | StarcoderdataPython |
146197 | <gh_stars>1-10
# 1Password item usage logs don't have event types, this file is a placeholder. All events are
# the viewing or usage of an item in 1Password
| StarcoderdataPython |
1650041 | <gh_stars>0
import os
import random
# Clears the terminal screen, and displays a title bar.
def displayTitleBar():
os.system("clear")
print("------- Match engine simulator -------\n")
# Simulates a match between two teams and displays the result
def playMatch(firstTeam, secondTeam):
a = int(input("\n" + f... | StarcoderdataPython |
1609878 | from collections import Counter
from copy import copy
import json
import numpy as np
import re
import logging
from stanza.models.common.utils import ud_scores, harmonic_mean
from stanza.utils.conll import CoNLL
from stanza.models.common.doc import *
logger = logging.getLogger('stanza')
def load_mwt_dict(filename):
... | StarcoderdataPython |
39188 | from __future__ import print_function
from argparse import ArgumentParser
from fastai.learner import *
from fastai.column_data import *
import numpy as np
import pandas as pd
def build_parser():
parser = ArgumentParser()
parser.add_argument('--data', type=str, nargs=None, dest='in_path', help='input file pa... | StarcoderdataPython |
1621874 | <reponame>xformation/awsscripter
import click
@click.command(name="tcp")
def security_tcp():
print ("TCP security check") | StarcoderdataPython |
3215239 | <reponame>accasio/keras-retinanet
"""
Copyright 2017-2018 Fizyr (https://fizyr.com)
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 b... | StarcoderdataPython |
3235286 | class Solution:
def isMonotonic(self, nums: List[int]) -> bool:
decrease = True
increase = True
i = 0
while i < len(nums)-1:
if nums[i] < nums[i+1]:
decrease = False
if nums[i] > nums[i+1]:
increase = False
i += 1
... | StarcoderdataPython |
1777496 | from floodsystem.stationdata import build_station_list
from floodsystem.station import inconsistent_typical_range_stations
import test_geo
stations = build_station_list()
x = inconsistent_typical_range_stations(stations)
print(x)
y = test_geo.test_stations_with_inconsistent_data()
print(y)
| StarcoderdataPython |
181455 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
import plugin.models as models
from plugin import plugin_reg
def plugin_update(queryset, new_status: bool):
"""general function for bulk changing plugins"""
apps_changed = False
# run through... | StarcoderdataPython |
4825407 | <reponame>lycantropos/voronoi<gh_stars>0
from hypothesis import given
from tests.integration_tests.hints import BoundPortedRobustFloatsPair
from tests.integration_tests.utils import are_bound_ported_robust_floats_equal
from . import strategies
@given(strategies.robust_floats_pairs, strategies.robust_floats_pairs)
de... | StarcoderdataPython |
1647305 | <filename>AutotestWebD/apps/user_center/views/user_token.py
from apps.common.func.CommonFunc import *
from apps.common.func.LanguageFunc import *
from django.shortcuts import render, HttpResponse
from apps.user_login.services.user_loginService import UserLoginService
from urllib import parse
from apps.user_center.servi... | StarcoderdataPython |
66145 | ###
# Copyright (c) 2002-2004, <NAME>
# Copyright (c) 2008-2010, <NAME>
# Copyright (c) 2014, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must ret... | StarcoderdataPython |
3374431 | <reponame>nkkchem/ModelSEEDDatabase
#!/usr/bin/env python
import os
import sys
import subprocess
import time
import copy
import re
import json
arguments = list(sys.argv)
#Pop filename
arguments = arguments[1:]
if(len(arguments) != 1 or re.search('^cpd\d{5}$',arguments[0]) is None):
print("Error: script must be ini... | StarcoderdataPython |
197352 | # Authors: <NAME>, <NAME>, <NAME>
import threading
import socket
import time
import server
class MultiChat(server.MessagingServer):
def __init__(self):
self.name = socket.gethostname()
self.ip_address = socket.gethostbyname(self.name)
self.port = 50001
self.socket = socket.socke... | StarcoderdataPython |
3299137 | # Per ddc
class MyPlayer:
def __init__(self, payoff_matrix, number_of_iterations):
self.payoff_matrix = payoff_matrix
self.number_of_iterations = number_of_iterations
self.movement = [True, True, False]
self.x = 0
return
def move(self):
move = self.movement[self... | StarcoderdataPython |
1697762 | from ctypes import byref, sizeof, c_uint32
from typing import Optional, List, Callable
import gc
from .vimba_object import VimbaObject
from .vimba_exception import VimbaException
from .frame import Frame
from . import vimba_c
SINGLE_FRAME = 'SingleFrame'
CONTINUOUS = 'Continuous'
def _camera_infos() -> List[vimba_... | StarcoderdataPython |
1627129 | <reponame>Arcangellmar/python_database
import pymysql
from contacto import Contacto
class DataBase():
def __init__(self):
self.connection = pymysql.connect(
host = 'localhost',
user = 'root',
password = '<PASSWORD>.',
database = 'test'
)
try:... | StarcoderdataPython |
3247632 | <reponame>Ryan-Gouldsmith/MajorProject-MapMyNotes
from MapMyNotesApplication import database
from MapMyNotesApplication.models.calendar_item import CalendarItem
from flask import Flask
from flask.ext.testing import TestCase
class TestCalendarItem(TestCase):
def create_app(self):
app = Flask(__name__)
... | StarcoderdataPython |
1652467 | import pathlib
import subprocess
import typing
import libzfs
import zonys
import zonys.core
import zonys.core.zfs
import zonys.core.zfs.dataset
import zonys.core.zfs.snapshot
import zonys.core.zfs.property
class AlreadyExistsError(RuntimeError):
def __init__(self, name):
super().__init__("File system {}... | StarcoderdataPython |
1765197 | <reponame>beckerrh/fempy
import test_elliptic
import test_stokes
import test_elasticity | StarcoderdataPython |
1759204 | <filename>tests/data.py
from __future__ import unicode_literals
success_send_action_response = {
'recipient_id': '111',
}
success_send_attachment_response = {
'recipient_id': '111',
'message_id': 'mid.1469190965111:a229991ed7b8f01222'
}
failed_send_response = {
'error': {
'message': 'Invalid ... | StarcoderdataPython |
172838 | <filename>ui/web.py<gh_stars>0
import datetime
import flask
import postgresql
import json
import locale
import pytz
from dateutil.relativedelta import relativedelta
from flask import Flask, render_template, request
app = Flask(__name__)
# load json config file
with open('web.config') as json_file:
conf = json.l... | StarcoderdataPython |
3359799 | <gh_stars>1-10
'''This module contains functions relating to data harmonization.
'''
from maayanlab_bioinformatics.harmonization.ncbi_genes import ncbi_genes_fetch, ncbi_genes_lookup
from maayanlab_bioinformatics.harmonization.transcripts import transcripts_to_genes
| StarcoderdataPython |
155800 | # coding:utf-8
"""
Name : config.py
Author : blu
Time : 2022/3/7 16:19
Desc :
"""
Debug = False
filter_host = "http://192.168.9.166:5000"
class DatabaseConfig:
mongo_host = 'XXXX'
mongo_user = 'XXXX'
mongo_pwd = '<PASSWORD>'
mongo_database = 'XXXX'
| StarcoderdataPython |
3332301 | <filename>guitar_set/util.py
"""util
"""
import os
from genericpath import isfile
from os.path import join
def ext_f_condition(f, dirpath, ext):
return isfile(join(dirpath, f)) & (f.split('.')[1] == ext)
def get_immediate_subdirectories(a_dir):
return [name for name in os.listdir(a_dir)
if os.p... | StarcoderdataPython |
1715592 | <reponame>brokenhammer/kaskade<filename>kaskade/pyir/functions.py
from numpy import dtype
from .node import FuncNode, Node
from llvmlite import ir
from .typing import DType, type_map_llvm
def sin(src_node:Node) -> FuncNode:
return FuncNode(src_node.size, "llvm.sin", src_node.dtype,[src_node]) | StarcoderdataPython |
21409 | <filename>tea/balance.py<gh_stars>10-100
#! /usr/bin/env python
############################# BEGIN FRONTMATTER ################################
# #
# TEA - calculates Thermochemical Equilibrium Abundances of chemical species #
# ... | StarcoderdataPython |
1608436 | from collections import defaultdict
import os
from biicode.common.settings.version import Version
'''
Module to create the cmake lines with the info of the boards.
It return the string that it is needed to compile and upload correctly the scketch to the Arduino.
This module is used always that biicode biicode create ... | StarcoderdataPython |
3265077 | <filename>torchvision/prototype/features/_feature.py<gh_stars>1-10
from typing import Any, cast, TypeVar, Union, Optional, Type, Callable, Tuple, Sequence, Mapping
import torch
from torch._C import _TensorBase, DisableTorchFunction
F = TypeVar("F", bound="_Feature")
class _Feature(torch.Tensor):
def __new__(
... | StarcoderdataPython |
3393094 | """ Core ML functions"""
import pandas as pd
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.multioutput import MultiOutputRegressor
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.model_selection import LeavePGroupsOut
from sklearn.preprocessing import Robus... | StarcoderdataPython |
109841 | <gh_stars>0
from src.discord.bot import DiscordBOT
if __name__ == "__main__":
bot = DiscordBOT()
bot.launch()
| StarcoderdataPython |
1674919 | <reponame>jdhughes-usgs/mf6bmipaper-saghen
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
class USGSFigure:
def __init__(
self, figure_type="map", family="Arial Narrow", font_path=None,
verbose=False
):
"""Create a USGSFigure object
... | StarcoderdataPython |
58720 | <reponame>harshchau/slurper
import os
import boto3
class DBUtils:
always_insert = True
def __init__(self):
# If URLS_TABLE present in os.environ, use it, else use the urls_table
# This is used in case the table name comes from the serverless setting
if 'URLS_TABLE' in os.environ:
... | StarcoderdataPython |
4823767 | from . import multi_user
from . import single_user | StarcoderdataPython |
190603 | from dataclasses import dataclass
from didcomm.did_doc.did_resolver import DIDResolver
from didcomm.secrets.secrets_resolver import SecretsResolver
# TODO: Decide if we want to provide a possiblity to register default resolvers,
# or it's better to always pass ResolversConfig explicitly to every pack/sign/unpack/etc... | StarcoderdataPython |
3355542 | <filename>.venv/lib/python3.8/site-packages/cleo/commands/__init__.py
# -*- coding: utf-8 -*-
from .base_command import BaseCommand
from .command import Command
__all__ = ["BaseCommand", "Command"]
| StarcoderdataPython |
3360709 | import re
import requests
from bs4 import BeautifulSoup
def get_page_content(url, timeout=5):
try:
# Make the request
response = requests.get(url, stream=True,timeout=timeout)
# Check status code
if response.status_code != 200:
raise Exception(response.status_code)
... | StarcoderdataPython |
9721 | import pandas_datareader.data as pdr
import yfinance as fix
import numpy as np
fix.pdr_override()
def back_test(strategy, seq_len, ticker, start_date, end_date, dim):
"""
A simple back test for a given date period
:param strategy: the chosen strategy. Note to have already formed the model, and fitted with... | StarcoderdataPython |
3238838 | <reponame>alexandreMayerowitz/playground-plums
import os
import os.path
import fnmatch
import errno
import stat
from os import scandir, walk
try:
from os import PathLike
except ImportError:
PathLike = object
def _fnmatch(root, name, pat):
if pat == '**':
p = root + name
return p.is_dir()... | StarcoderdataPython |
3316629 | <filename>applied_python/applied_python/lib/python2.7/site-packages/pylint/test/input/func_w0631.py
"""Check possible undefined loopvar
"""
from __future__ import print_function
__revision__ = 0
def do_stuff(some_random_list):
"""This is not right."""
for var in some_random_list:
pass
print(var)
... | StarcoderdataPython |
1680487 | """Abstract outbound queue."""
from abc import ABC, abstractmethod
class BaseOutboundMessageQueue(ABC):
"""Abstract outbound queue class."""
@abstractmethod
async def enqueue(self, message):
"""
Enqueue a message.
Args:
message: The message to send
"""
... | StarcoderdataPython |
3369029 | import unittest
from mirror_words import mirror_words
class TestMirrorWords(unittest.TestCase):
def test1(self):
sentence = ""
self.assertEqual(mirror_words(sentence, len(sentence)), "")
def test2(self):
sentence = " "
self.assertEqual(mirror_words(sentence, len(sen... | StarcoderdataPython |
4819261 | #!/usr/bin/env python
import logging
import os
import time
from django import setup
from django.conf import settings
from django.core import management
logger = logging.getLogger(__name__)
if __name__ == "__main__":
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'model_garden.settings')
setup()
while True:
... | StarcoderdataPython |
3202085 | #!/usr/bin/python3
# Manage DNS Records
# Functions:
# - Add
# - Update
# - Delete
# Usage:
# ./dns_records.py <zone_id> <command> [name] [type] [content] [ttl] [record_id]
# WGM CloudFlare integration
import cf
# WGM DB Integration
import wgm_db
# Other dependencies
import sys
import psycopg2.extras
def update_dns... | StarcoderdataPython |
3209806 | from sources import wit_handler
import wit
import logging
import pytest_mock as mocker
import pytest_capturelog as caplog
class MockWitClass(wit.Wit):
def __init__(self, access_token, actions=None, logger=None):
super(MockWitClass, self).__init__(access_token, actions, logger)
def __init__(self, wit... | StarcoderdataPython |
154204 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('fluent_contents', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='YandexMapItem',
fi... | StarcoderdataPython |
159599 | #!/usr/bin/env python
# Core
from __future__ import print_function
from decimal import *
from functools import wraps
import logging
import math
import pprint
import random
import re
import time
import ConfigParser
# Third-Party
import argh
from clint.textui import progress
import funcy
import html2text
from PIL im... | StarcoderdataPython |
3375137 | from sympy import diff, symbols, Matrix, sin, cos, pprint
from sympy.utilities.codegen import codegen
a, b, c = symbols("a,b,c")
x, y, z = symbols("x,y,z")
X = Matrix([[ 1, 0, 0],
[ 0, cos(x), -sin(x)],
[ 0, sin(x), cos(x)]])
Y = Matrix([[ cos(y), 0, sin(y... | StarcoderdataPython |
192654 | # -*- coding: utf-8 -*-
citation = {'ref': u"<NAME>., <NAME>,. <NAME>, and M. "
u"Pohlschröder. 2002. Adaptation of protein secretion "
u"to extremely high salt concentrations by extensive use "
u"of the twin arginine translocation pathway. Mol. Microbiol."
... | StarcoderdataPython |
1780751 | from rest_framework import serializers
from ...models import TributoSezErario
class TributoSezErarioSerializer(serializers.ModelSerializer):
class Meta:
model = TributoSezErario
exclude = ["imposta"]
| StarcoderdataPython |
1654008 | <filename>tests/test_utils.py
from ddpserver import utils
from nose.tools import assert_equal, assert_not_equal
def test_gen_id():
assert_not_equal(utils.gen_id(), utils.gen_id())
assert_equal(len(utils.gen_id()), 17)
assert_equal(len(utils.gen_id(10)), 10)
| StarcoderdataPython |
4833153 | <gh_stars>10-100
#!/usr/bin/python
# Intersect Framework (c) 2012
# Server-side template & module handler
# https://github.com/ohdae/Intersect-2.5
import os, sys, re, signal
import socket
import time
from subprocess import Popen,PIPE,STDOUT,call
from base64 import *
import datetime
import platform
import urllib2
imp... | StarcoderdataPython |
3229446 | <filename>omas/examples/plot_omas_overlays.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
OMAS plot overlays
==================
This example loads sample DIII-D overlay data and generates an overlays plots
"""
from matplotlib.pyplot import show, gca
from omas import *
import numpy
# load sample data from S3
ods... | StarcoderdataPython |
1652265 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import os, curses, curses.ascii, subprocess
import glob
from time import sleep
class Wrapper(object):
deploy_dir = os.path.join("..", "virtualisation", "autodeploy")
def __init__(self, deploy_json):
self.dir = os.path.dirname(deploy_json... | StarcoderdataPython |
1676795 | # coding: utf-8
# 2021/3/18 @ tongshiwei
from .meta import KTM
from .KPT import KPT
from .EKPT import EKPT
from .DKT import DKT
from .DKTPlus import DKTPlus
from .AKT import AKT
from .LPKT import LPKT
from .DKVMN import DKVMN
| StarcoderdataPython |
118913 | <reponame>klem4/panacea<gh_stars>1-10
# coding: utf-8
import panacea.config as conf
from panacea.schemes import CacheScheme, CacheConf
from panacea import tools
logger = tools.get_logger()
class CacheEngine(object):
u"""
движок кеширующего механизма
"""
def __init__(self, request, response):
... | StarcoderdataPython |
3359245 | from pydantic import BaseModel
from typing import List, Optional
class CastIn(BaseModel):
name: str
nationality: Optional[str] = None
class CastOut(CastIn):
id: int
class CastUpdate(CastIn):
name: Optional[str] = None
| StarcoderdataPython |
1747883 | <reponame>Biewer/Doping-Tests-for-Cyber-Physical-Systems-Tool<gh_stars>0
class Distance(object):
"""Abstract class that defines the interface that the implementations of distance functions must adhere to."""
def __init__(self, values_domain, threshold):
super(Distance, self).__init__()
self.values_domain = values... | StarcoderdataPython |
149999 | # -*- coding: utf-8 -*-
"""Top-level package for PCap Filter."""
__author__ = """<NAME>"""
__email__ = "<EMAIL>"
__version__ = "__version__ = '0.2.1'"
| StarcoderdataPython |
1671975 | <reponame>DomineCore/bk-sops
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use ... | StarcoderdataPython |
116054 | obstacleSet = set([(10, 2, 4, 5), (3, 4), (4, 4), (5, 4)])
print((2, 4) in obstacleSet)
print(obstacleSet)
print(set([(1, 2), (3, 4)]))
| StarcoderdataPython |
3233284 | <gh_stars>1-10
# Import libraries
import argparse, json, math, sys, time, urllib.request
# Earth radius (km)
EARTH_RADIUS = 6373.0
# Server endpoint
SAFEWAY_ENDPOINT = 'https://s3-us-west-2.amazonaws.com/mhc.cdn.content/vaccineAvailability.json'
def coord_dist(origin, destination):
"""
Calculate the Haversin... | StarcoderdataPython |
189211 | <reponame>nilsvu/spectre
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
def spatial_velocity_oneform(spatial_velocity, spatial_metric):
return np.einsum("a, ia", spatial_velocity, spatial_metric)
def spatial_velocity_squared(spatial_velocity, spatial_metric):
return ... | StarcoderdataPython |
13396 | <gh_stars>0
from collections import OrderedDict, defaultdict
import numpy as np
'''
generate a id to length dic
'''
def gen_sid_len(sentences):
sid2len = OrderedDict()
for i, sent in enumerate(sentences):
sid2len[i] = len(sent)
return sid2len
def batch_slice(data, batch_size):
# data is a li... | StarcoderdataPython |
1752658 | """A sub-package containing functions to perform belief propagation."""
| StarcoderdataPython |
132623 | # -*- coding:utf-8 -*-
# Author:lixuecheng
from selenium import webdriver
import time
import os
from pro.core.logger import log, logger
from pro.util.parse_msg import p_addhttp
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.action... | StarcoderdataPython |
1704113 | <filename>tests/test_musescore.py
"""Test cases for MUSESCORE I/O."""
import math
import numpy as np
import pytest
import muspy
from muspy.inputs.musescore import MuseScoreWarning
from muspy.utils import CIRCLE_OF_FIFTHS, MODE_CENTERS
from .utils import TEST_MUSESCORE_DIR, TEST_MUSESCORE_LILYPOND_DIR
def check_leg... | StarcoderdataPython |
159489 | from flask import Flask
from glob import escape
app = Flask(__name__)
# global escape: true
@app.route('/')
def index():
return 'Index Page'
@app.route('/datum')
def hello():
return 'The data to provide!'
@app.route('/unit/<uuid:unit_id>')
def show_unit(unit_id):
return 'Unit ID %d, albeit this would us... | StarcoderdataPython |
1789891 | # -*- coding: utf-8 -*-
import logging
import logging.config
from amplify.agent.context import context
try:
import thread
except ImportError:
# Renamed in Python 3
import _thread as thread
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__credits__ = ["<NAME>", "<N... | StarcoderdataPython |
3358236 |
def main():
runningTotal = 0
for i in range(1000):
if i%5 == 0 or i%3 == 0:
runningTotal += i
print(str(runningTotal))
main() | StarcoderdataPython |
1613932 | <filename>Discord Bots/Galaxy Studio/cogs/money/commands.py
import discord, time, asyncio, os, random, json
from discord.ext import commands, tasks
from discord.ext.commands import has_permissions, cooldown, MissingPermissions, check, Cog
from discord.utils import get
def is_wiggle_or_luna(ctx):
return ctx.author.... | StarcoderdataPython |
1697029 | <filename>python-course-softuni/data-structures/ex1.py
# User input
sentence = input('Write sentence: ')
# Cun text to 10th elements and ellipsis to the end
if len(sentence) > 10:
sentence = sentence[:10] + '...'
print(sentence)
| StarcoderdataPython |
1662986 | <reponame>MisterHat-89/geekBrainsPython<filename>Lesson_8/exam_6.py<gh_stars>0
# 6. Продолжить работу над вторым заданием. Реализуйте механизм валидации вводимых пользователем данных.
# Например, для указания количества принтеров, отправленных на склад, нельзя использовать строковый тип данных.
# Подсказка: постарайтес... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.