id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3259902 | from hydromet import*
#---------------------------------------------------------------------------#
def main(binData: list, incr_excess: pd.DataFrame, tempE: float,
convE: float, volE: float, tsthresh: float,
display_print: bool=True) -> dict:
... | StarcoderdataPython |
4946160 | <gh_stars>1-10
import cv2
import imutils
import numpy as np
from skimage.filters import threshold_local
import argparse
def order_points(pts):
# initialzie a list of coordinates that will be ordered
# such that the first entry in the list is the top-left,
# the second entry is the top-right, the third is t... | StarcoderdataPython |
6583754 | <filename>sumo/tools/district/countConnectionsInDistricts.py
#!/usr/bin/env python
"""
@file countConnectionsInDistricts.py
@author <NAME>
@author <NAME>
@date 2007-07-26
@version $Id$
<documentation missing>
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2007-2017 DLR (http://www.d... | StarcoderdataPython |
3328451 | import os, sys; sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import pytest
from lasio import read, ExcelConverter
from lasio.reader import StringIO
test_dir = os.path.dirname(__file__)
egfn = lambda fn: os.path.join(os.path.dirname(__file__), "examples", fn)
def test_write_sect_widths_12():
... | StarcoderdataPython |
5170722 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic... | StarcoderdataPython |
1627798 | <gh_stars>10-100
#!/usr/bin/env python3
from serverpanel import create_app
application = create_app('config')
| StarcoderdataPython |
8095767 | import pyglet
from pyglet.gl import glTexParameteri, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST
from pyglet.window import key
class GameWindow(pyglet.window.Window):
""" Display the game window, and manages keyboard input and processor cycling. """
def __init__(self, processor, frequency, key_map, *args... | StarcoderdataPython |
3543549 | import pandas as pd
from evidently.dashboard.widgets.utils import CutQuantileTransformer
import pytest
@pytest.mark.parametrize(
"side, quantile, test_data",
(
(
"right",
0.50,
pd.DataFrame({"data": [1, 2, 3, 4]}),
),
("left", 0.50, pd.DataFrame({"... | StarcoderdataPython |
9695272 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/07_freemap.ipynb (unless otherwise specified).
__all__ = ['FreeMap']
# Cell
from collections import OrderedDict
# Cell
class FreeMap:
def __init__(self,
func= lambda x:x,
filter_function = lambda x: True,
flatten =... | StarcoderdataPython |
9633148 | <gh_stars>1-10
# Generated by Django 3.2 on 2021-05-21 12:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20210521_1237'),
]
operations = [
migrations.CreateModel(
name='ModelTest',
fields=[
... | StarcoderdataPython |
3490442 | from autogoal.search import RichLogger
from autogoal.experimental.metalearning.utils import MTL_RESOURCES_PATH
from pathlib import Path
import math
import uuid
import json
class ResultsLogger(RichLogger):
def __init__(self, learner_name: str, name: str=""):
super().__init__()
self.name: str = nam... | StarcoderdataPython |
9649125 | <gh_stars>0
import npyscreen
from forms.w_players_grid import WidgetPlayersGrid
class CreateSessionWaitingForm(npyscreen.ActionForm):
"""docstring for MainForm"""
def create(self):
self.name = "Created Session:"
self.OK_BUTTON_TEXT = "Start"
self.CANCEL_BUTTON_TEXT = "Leave"
sel... | StarcoderdataPython |
1743116 | <reponame>waterdrinker/gblog<filename>gblog/server.py
import os.path
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.escape
import signal
import sys
import logging
import gblog.handlers as handlers
from gblog import mytorndb
from gblog import config
from gblog import uimodule
class ... | StarcoderdataPython |
9773793 | <reponame>cnb0/katcp-python
# test_client.py
# -*- coding: utf8 -*-
# vim:fileencoding=utf8 ai ts=4 sts=4 et sw=4
# Copyright 2009 National Research Foundation (South African Radio Astronomy Observatory)
# BSD license - see LICENSE for details
"""Tests for client module."""
from __future__ import absolute_import, div... | StarcoderdataPython |
6487854 | <reponame>hurschler/pig-face-recognition<filename>util/feature_maps.py
import numpy as np
import tensorflow as tf
import os
from tensorflow import keras
from tensorflow.keras.preprocessing.image import ImageDataGenerator, img_to_array, load_img
import matplotlib.pyplot as plt
os.environ['TF_XLA_FLAGS'] = '--tf_xla_ena... | StarcoderdataPython |
3447066 | """
LC523 -- Continuous Subarray Sum
Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to a multiple of k, that is, sums up to n*k where n is also an integer.
Example 1:
Input: [23, 2, 4, 6, 7], k=6
Output... | StarcoderdataPython |
8173692 | n = int(input())
a = []
b = []
for _ in range(n):
ai, bi = map(int, input().split())
a.append(ai)
b.append(bi)
cnt = 0
for i in range(n - 1, -1, -1):
rest = (a[i] + cnt) % b[i]
if rest != 0:
cnt += b[i] - rest
print(cnt)
| StarcoderdataPython |
6486071 | <reponame>xuebingwu/trams<filename>generate_xml.py
'''
python3 script to generate a maxquant xml file from a template xml and a folder of raw files
Changes the following entries in the xml file:
input file related: filePaths, experiments, fractions, ptms, paramGroupIndices, referenceChannel
Can also change pr... | StarcoderdataPython |
3249315 | <reponame>BioGeek/vispy-tutorial
# pylint: disable=invalid-name, no-member, unused-argument
""" passing varyings to fragment """
import numpy as np
from vispy import app, gloo
from vispy.util.transforms import translate, perspective, rotate
# note the 'color' and 'v_color' in vertex
vertex = """
uniform mat4 u_model... | StarcoderdataPython |
12807356 | import numpy as np
import matplotlib.pyplot as plt
from scipy.special import erfc
import lmfit
import logging
from pycqed.analysis import analysis_toolbox as a_tools
from pycqed.analysis.tools import data_manipulation as dm_tools
#################################
# Fitting Functions Library #
####################... | StarcoderdataPython |
1660395 | """Pycep plugin function library."""
# coding=utf-8
import re
import random
import string
from glob import glob
from shutil import move, Error, rmtree
from logging import info, error
from yaml_info.yamlinfo import YamlInfo
from pycep.render import write_to_file
from pycep.model import get_value, strip_unsafe_file_names... | StarcoderdataPython |
3212339 | import time
import pprint
from faker import Faker
import argparse
# =========================================================
# G L O B A L S
# =========================================================
# Initiate 'Faker' and 'PrettyPrinter' :-)
pp = pprint.PrettyPrinter(indent=4)
faker = Faker()
... | StarcoderdataPython |
8084453 | <reponame>harry-kav/ECM-2434-Group-Software-deploy1<gh_stars>1-10
# Generated by Django 4.0.1 on 2022-02-28 16:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('polls', '0004_image_score'),
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
6454995 | <reponame>braniii/prettypyplot<gh_stars>0
"""
.. include:: ../README.md
"""
# both are set in style submodule to default value
MODE = None
STYLE = None
from .colors import *
from .plot import *
from .style import *
from .texts import *
from .subplots import *
__version__ = '0.7.1'
| StarcoderdataPython |
4889629 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
certifi.py
~~~~~~~~~~
This module returns the installation location of cacert.pem.
"""
import os
import warnings
class DeprecatedBundleWarning(DeprecationWarning):
"""
The weak security bundle is being deprecated. Please bother your service
... | StarcoderdataPython |
5086249 | """NDG Security Obligation type definition
NERC DataGrid
"""
__author__ = "<NAME>"
__date__ = "24/02/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__contact__ = "<EMAIL>"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "<EMAIL>"
__revision__ = "$Id$"
from ndg.xacm... | StarcoderdataPython |
1944426 | #!/usr/bin/python3
import datetime
import sys
import time
import TimeUtils
import SmartPrint
if len(sys.argv) < 2:
t = time.time()
else:
t = float(sys.argv[1])
print(TimeUtils.niceFromEpoch(t))
| StarcoderdataPython |
180058 | <reponame>msmiglo/pkwscraper
from unittest import main, skip, TestCase
from unittest.mock import call, MagicMock, patch
from xxx import yyy
class Test(TestCase):
"""
- test
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_(self):
# arrange
... | StarcoderdataPython |
12859333 | <filename>lf3py/task/data.py<gh_stars>0
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import Any, List, Type, TypeVar
from lf3py.lang.dsn import DSN
from lf3py.serialization.serializer import DictSerializer, Serializer
T_OBJ = TypeVar('T_OBJ')
class Command(metaclass=ABCMeta)... | StarcoderdataPython |
6543848 | <filename>Exercicios/Resposta-EstruturaSequencial/Exerc_10.py
# Faça programa que converta Celsius para Fahrenheit
print('Convertendo Celsius em Fahrenheit!!!')
c = float(input('Entre com a temperatura em Celsius: '))
f = (c * 9 / 5) + 32
print(f'A temperatura {c:.1f}°F é {f:.1f}°C')
| StarcoderdataPython |
6480646 | from abc import abstractmethod, ABCMeta
from slack_bolt.request import BoltRequest
from slack_bolt.response import BoltResponse
class ListenerMatcher(metaclass=ABCMeta):
@abstractmethod
def matches(self, req: BoltRequest, resp: BoltResponse) -> bool:
"""Matches against the request and returns True if... | StarcoderdataPython |
9784743 | import torch
import torch.nn as nn
import sys, os
sys.path.insert(1, os.path.realpath(os.path.pardir))
from mediapipe_utils import generate_blazepose_anchors
import numpy as np
from math import pi
anchors = generate_blazepose_anchors()
print(f"Nb anchors: {len(anchors)}")
detection_input_length = 224
class Detection... | StarcoderdataPython |
1923805 | from logging import info, exception
from json import loads
from time import sleep
from fritzconnection import FritzConnection
from module import execute_os_cmd, execute_ssh_cmd, execute_request_http, get_string, DbManager
def cmd_ping(ip, pacchetti=1):
result = {}
try:
result['ip'] = ip
respon... | StarcoderdataPython |
120937 | <reponame>tom95/thrown-back
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import re
import os
import sys
import subprocess
import inkex
from simpletransform import computeBBox
class ExportSprites(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
def effect(self):
folder = self.get_folder()
... | StarcoderdataPython |
4830887 |
# folder_list.py
# response to request from 'zmq': folder_list
# it should in a json:
# {
# 'ask-for': 'folder_list',
# 'path' : string, the folder to give listing,
# 'username' : who ask for it
# ...
# }
import s3.folder.repr
def main(info):
folder_representation = s3.folder.repr.give_us... | StarcoderdataPython |
103417 | import sublime, sublimeplugin
import functools
import sys
class GotoSymbolCommand(sublimeplugin.TextCommand):
def gotoRegion(self, view, regions, index):
view.sel().clear()
view.sel().add(regions[index])
view.show(view.sel(), True)
def run(self, view, args):
pt = view.sel()[0].... | StarcoderdataPython |
274049 | <reponame>project-wazn/wazn-node-utilities<filename>binding.gyp
{
"targets": [
{
"target_name": "waznutilities",
"sources": [
"src/main.cc",
"src/cryptonote_core/cryptonote_format_utils.cpp",
"src/crypto/tree-hash.c",
"s... | StarcoderdataPython |
4888462 | <filename>main/admin.py<gh_stars>1-10
from django.contrib import admin
from django.contrib.auth.admin import GroupAdmin
from django.contrib.auth.models import Group
from django.db.models import CharField
from django.forms import Textarea
from .models import Setting, SystemMessage
admin.site.unregister(Group)
class ... | StarcoderdataPython |
8189128 | from mcrcon import MCRcon
from time import sleep
import configparser
import os
from datetime import timedelta
def mcrcon(config):
"""
Establish connection to mcrcon using MCRcon
return the object mcr so commands can be
sent from other functions
"""
mcr = MCRcon(config['RCON']['ser... | StarcoderdataPython |
1920232 | <filename>qtrader/utils/preprocessor.py<gh_stars>0
import numpy as np
import pandas as pd
def rolling1d(series, window):
"""Rolling window for a 1D series.
Parameters
----------
series: list | numpy.ndarray | pandas.Series
Sequential 1D data
window: int
Window size
Returns
... | StarcoderdataPython |
3567037 | from yarn.models import Thread, Artifact, Person, PersonAttribute, SolsticeFile, User, FavoriteThreads, ThreadNotification, ThreadManager, WebsocketAuthToken
import simplejson as json
import re
import hashlib
import sys
import time
import base64
from django.conf import settings
from datetime import datetime
from dateti... | StarcoderdataPython |
3258239 | import json
from api.request import RequestBase
from api.ipcheck import ServerTest, IPRegion, DnsLookup, is_ip_address
from api.template import Template
class AppCreate(RequestBase):
def __init__(self, data={}, region=None, test_result={}, template=None, handler=None):
# def __init__(self, method='GET',... | StarcoderdataPython |
1979382 | <gh_stars>100-1000
"""
You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol.
Find out how many ways to assign symbols to make sum of integers equal to target S.
Example 1:
Input: nums is ... | StarcoderdataPython |
3237225 | <reponame>yangdemin/dingpan
from huobi.model.constant import *
class CompleteSubAccountInfo:
"""
Sub-account completed info
:member
id: The sub-id.
account_type: The sub account type.
balances: The balance list, the content is Balance class.
"""
def __init__(self):
... | StarcoderdataPython |
395159 | # Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... | StarcoderdataPython |
4857078 | """
Actor-Critic model.
"""
import numpy as np
from itertools import count
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
SavedAction = namedtuple('SavedAction', ['log_prob', 'value'])
cl... | StarcoderdataPython |
1999755 | #
# Copyright 2021 Splunk 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 writing, so... | StarcoderdataPython |
241650 | #Develop a program that demonstrates the use of cloudmesh.common.StopWatch.
from cloudmesh.common import banner
from cloudmesh.common.StopWatch import StopWatch
from time import sleep
c = 0
StopWatch.start("test")
for i in range(100000):
True
StopWatch.stop("test")
result = StopWatch.get("test",6)
print(f"time to... | StarcoderdataPython |
4821619 | <filename>find_known_secrets/_secrets.py<gh_stars>1-10
_ = "teddy bear"
__ = "dinosuar"
| StarcoderdataPython |
26261 | import re
# crawl roster
faulty_prof = {
'Francis,J)' : 'Francis,J (jdf2)',
'Glathar,E)' : 'Glathar,E',
'Cady,B)' : 'Cady,B'
}
section_types = set()
day_pattern = {
'M': 1,
'T': 1<<1,
'W': 1<<2,
'R': 1<<3,
'F': 1<<4,
'S': 1<<5,
'U': 1<<6
}
def to_bool(s):
return True if ... | StarcoderdataPython |
3339748 | ################################################################################
#OpenShortcut FREEZE FILE
################################################################################
#Copyright (c) 2018 <NAME>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software a... | StarcoderdataPython |
6578082 | <filename>v2.5.7/toontown/toonfest/ToonfestPrizeCollect.py
from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import *
from toontown.catalog import CatalogGenerator, CatalogItemPanel, CatalogInvalidItem, CatalogItemTypes
from toontown.toonbase import ToontownGlobals
from panda3d.core import Ve... | StarcoderdataPython |
9730251 | import nltk
from repo.util import estrai_parole,pipe,argomenti
def get_parole(nome_file):
with open(nome_file,'r') as f:
righe = list(f.readlines())
return [estrai_parole(riga)for riga in righe]
def shallow_flatten(li):
new_li = []
for i in li:
for j in i:
n... | StarcoderdataPython |
9686786 | import pytest
from pg13 import pgmock, sqparse2, pg, sqex, pgmock_dbapi2, table
def prep(create_stmt):
"helper for table setup"
tables=pgmock.TablesDict()
tables.apply_sql(sqparse2.parse(create_stmt),(),None)
def runsql(stmt,vals=()): return tables.apply_sql(sqparse2.parse(stmt),vals,None)
return tables,runs... | StarcoderdataPython |
6698272 | # Generated by Django 3.1.3 on 2020-11-29 14:24
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0020_auto_20201128_1853'),
]
operations = [
migrations.AlterField(
model_name='hotel',
name=... | StarcoderdataPython |
9784625 | BASE = """# CHANGELOG
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Changelog](http://keepachangelog.com/).
"""
DEFAULT_VERSION = "0.0.0"
RELEASE_LINE = "## [{}] - ({})\n"
RELEASE_LINE_REGEXES = [
r"^##\s\[(?P<v... | StarcoderdataPython |
3468083 | import sys
import numpy as np
import statsmodels.api as sm
import matplotlib.pyplot as plt
from statsmodels.graphics import tsaplots
assert len(sys.argv)==2
infile = sys.argv[1]
[tt,nvac,nCO] = np.loadtxt(infile,usecols=(0,1,2),unpack=True)
assert np.min(nvac+nCO) == np.max(nvac+nCO)
Nsite = nvac[0]+nCO[0]
print("N... | StarcoderdataPython |
6424095 | import numpy as np
import argparse
import json
from PIL import Image
from time import time
import torch
import functions as func
def main():
start_time = time()
in_arg = get_input_args()
device = set_device(in_arg.gpu)
prob, classes = func.predict(in_arg.image_dir, in_arg.checkpoint,... | StarcoderdataPython |
5165907 | """Helpers for operating modules/parameters
Notes:
Useful regex expression
1. nothing else classifier: '^((?!classifier).)*$'
"""
import re
import logging
import pdb
import torch.nn as nn
class Freezer(object):
def __init__(self, module, patterns):
self.module = module
self.patterns = ... | StarcoderdataPython |
1862459 | <filename>connect/cli/core/constants.py
# -*- coding: utf-8 -*-
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli.
# Copyright (c) 2019-2021 Ingram Micro. All Rights Reserved.
DEFAULT_ENDPOINT = 'https://api.connect.cloudblue.com/public/v1'
DEFAULT_USER_AGENT = 'CloudBlue Connect CLI/'
DEFAULT_BA... | StarcoderdataPython |
5191843 | <reponame>ryosuke0825/atcoder_python
n = int(input())
al = list(map(int, input().split()))
ans = 0
while True:
for i in range(n):
if al[i] % 2 == 0:
al[i] = al[i]//2
else:
break
else:
ans += 1
continue
break
print(ans)
| StarcoderdataPython |
9721571 | <reponame>paularindam/SolarEstimator
import dataconverters.commas as commas
import numpy
from funcy import project as FilterDict
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem,MACCSkeys,AtomPairs
from rdkit.Chem.Fingerprints import FingerprintMols
from rdkit.Chem.AtomPairs import Pairs,Torsions
from... | StarcoderdataPython |
3559954 | import os
import re
import time
import json
import pytest
from swsscommon import swsscommon
from dvslib.dvs_common import wait_for_result
class TestMplsBase(object):
def mpls_appdb_mode(self):
# run in APP_DB mode unless using "fpmsyncd -l net"
return True
def setup_db(self, dvs):
sel... | StarcoderdataPython |
8120159 | <filename>install/Archive/logging_sparkfun.py
#!/usr/bin/python
# Google Spreadsheet BMP Sensor Data-logging Example
# Depends on the 'gspread' package being installed. If you have pip installed
# execute:
# sudo pip install gspread
# Copyright (c) 2014 Adafruit Industries
# Author: <NAME>
# Permission is hereby... | StarcoderdataPython |
9642205 | # Crie um programa que tenha uma função chamada voto()
# que vai receber como parâmetro o ano de nascimento de
# uma pessoa, retornando um valor literal indicando se uma
# pessoa tem voto NEGADO, OPCIONAL ou OBRIGATÓRIO nas eleições.
def voto(ano):
from datetime import date
anoAtual = date.today().year
idad... | StarcoderdataPython |
71883 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This will attempt to import the actual App Engine modules, and if it fails,
# they will be replaced with fake modules. This is useful during testing.
... | StarcoderdataPython |
11387160 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unittests for providers.
File: __init__.py
Author: huxuan
Email: i(at)<EMAIL>
"""
| StarcoderdataPython |
1959112 | <gh_stars>10-100
from .base import Tensor, _add_method
import inspect
import sys
import jax.lax as jla
import jax.numpy as jnp
from .base import jax_wrap
import symjax
module = sys.modules[__name__]
_JNP_NAMES = [c[0] for c in inspect.getmembers(jnp, inspect.isfunction)]
_TO_SKIP = [
"<lambda>",
"blackman",... | StarcoderdataPython |
4926679 | from homework2 import histogram
data = [-1,-1,-1,10,10]
hist = histogram(data, 5, -1, 10)
print(hist)
| StarcoderdataPython |
9645869 | import datetime
from peewee import *
from money.app import db
class BaseModel(Model):
class Meta:
database = db
# Currency model
class Currency(BaseModel):
code = CharField(unique=True, max_length=3)
name = CharField()
min_size = FloatField()
created_at = DateTimeField(default=datetime.datetime.now)
updated_... | StarcoderdataPython |
8037835 | <filename>nla_recipes/libpng/conanfile.py
import os
from conans import ConanFile, CMake, tools
class LibpngConan(ConanFile):
name = "libpng"
version = "1.6.37"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared":... | StarcoderdataPython |
4908679 | import random as _random
import string as _string
def randomstring(length=5, alphabet=_string.ascii_letters):
return "".join(_random.choice(alphabet) for _ in range(length))
| StarcoderdataPython |
11217913 | from __future__ import annotations
import logging
from typing import (
TYPE_CHECKING,
)
from .constants import (
MAX_FLOAT,
)
from .abc import (
Model,
)
if TYPE_CHECKING:
from typing import (
Dict,
Any,
Generator,
Tuple,
)
from .positions import (
Posit... | StarcoderdataPython |
3428466 | # -*- coding: utf-8 -*-
def mm2px(mm, lam, px_in_lam):
return mm / lam * px_in_lam
def px2mm(px, lam, px_in_lam):
return px / px_in_lam * lam
| StarcoderdataPython |
331842 | <filename>warranty/urls.py
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from . import views
from .views import WarrantyFormView
from .views import WarrantyList
from .views import WarrantyUpdateView
from .views import WarrantyDelete
app_name = 'warranty'
u... | StarcoderdataPython |
1999144 | <filename>additional_functions.py<gh_stars>0
from algoritmo_genetico import optimizar as optimizar_ag
from simulated_annealing import optimizar as optimizar_sa
import time
from dominio_tsp import DominioTSP
from dominio_ag_tsp import DominioAGTSP
import numpy as np
import matplotlib.pyplot as plt
def calcular_tiempos... | StarcoderdataPython |
6633234 | <reponame>elolugo/profiles-res-api
from rest_framework import serializers
from profiles_api import models
class HelloSerializer(serializers.Serializer):
"""
Serializes a name field for testing our APIView.
Converts and validates the inputs to the methods
of an API
"""
name = serializers.CharFi... | StarcoderdataPython |
1629272 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
streaming_service property
"""
from rebulk.remodule import re
from rebulk import Rebulk
from rebulk.rules import Rule, RemoveMatch
from ..common.pattern import is_disabled
from ...rules.common import seps, dash
from ...rules.common.validators import seps_before, seps_... | StarcoderdataPython |
4802193 | from typing import Text
from linebot.models import TemplateSendMessage, ButtonsTemplate
from linebot.models.actions import PostbackAction
from models.message_request import MessageRequest
from skills import add_skill
@add_skill('{action_postback}')
def get(message_request: MessageRequest):
msg = Templa... | StarcoderdataPython |
3339092 | # coding: utf-8
# Copyright (c) 2015 <NAME> <<EMAIL>>
# License: MIT (see LICENSE file)
from kivy.uix.screenmanager import ScreenManager
class HistoricScreenManager(ScreenManager):
def __init__(self, *args, **kwargs):
super(HistoricScreenManager, self).__init__(*args, **kwargs)
self.screen_hist... | StarcoderdataPython |
190401 | from itertools import count
from typing import Iterable, Dict, List
class IndexMapper:
"""
This class maps between the different atoms objects in a MAZE-sim project.
It is essential for keeping track of the various
"""
id = 0
@staticmethod
def get_id():
"""
Get a unique i... | StarcoderdataPython |
1637031 | <gh_stars>1-10
"""
@author <NAME>
A.I. Engineer & Software developer
<EMAIL>
Created on 03 December, 2017 @ 8:43 PM.
Copyright © 2017. Victor. All rights reserved.
"""
import time
import gym
import numpy as np
def gen_policy():
return np.random.choice(4, size=[16])
def policy_to_action(obs, pol... | StarcoderdataPython |
1697076 | <filename>SCSGA-Benchmark/cem.py
#!/usr/bin/env python3
import argparse
import random
import multiprocessing
import os
import numpy as np
import logging
from experiment_description import ExperimentDescription
import sys
# TODO: What's the path on Windows? Append both or have an if-statement
sys.path.append('../buil... | StarcoderdataPython |
393654 | #!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | StarcoderdataPython |
1959785 |
import struct
def saveFile() :
global window, canvas, paper, filename,inImage, outImage,inW, inH, outW, outH
saveFp = asksaveasfile(parent=window, mode='wb',
defaultextension="*.raw", filetypes=(("RAW파일", "*.raw"), ("모든파일", "*.*")))
for i in range(outW):
for k i... | StarcoderdataPython |
6443426 | import os
import os.path
import player
import persistence
import mediaFileHelper
class MappedPlayer:
def __init__(self):
base_dir = os.path.join(os.path.dirname(__file__), "..", "files")
self._player = player.Player()
self._file_helper = mediaFileHelper.MediaFileHelper(base_dir)
self._position_storage = pers... | StarcoderdataPython |
11255886 | import sqlite3
def generate_vm_data(db_file):
RAW_VM_LIST = [
('ID', 'Name', 'Status', 'Networks', 'Image', 'Flavor'),
('f79d1ffe-e284-4b86-926a-c6a6b23859d1', 'perla-08', 'ACTIVE', '',
'CentOS7-tf_siesta_fann', 'perla-pv.xlarge'),
('3bacfad2-2256-4743-a55a-b176aa8f6679', 'perla-0... | StarcoderdataPython |
8022129 | <gh_stars>0
from .models import Order
from . import utils
from django.core.mail import EmailMessage
def EMAILCreated(order_id):
order = Order.objects.get(id=order_id)
context = {
"order_id" : order.id,
"order_created": order.created,
"order_first_name" : order.first_nam... | StarcoderdataPython |
6789 | <filename>terrafirma/core/views/env.py
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse_lazy
from django import views
from django.views import generic as g_views
from django.views.generic import base as b_views, edit as e_views
from .. import forms, models
class NewEnv... | StarcoderdataPython |
3553742 |
import os, numpy as np, warnings
class DOSStitcherBase:
def __call__(self, original_dos_hist, new_dos_hist, Emin, Emax):
"""Update the portion of DOS in between `Emin` and `Emax` with the new
DOS curve. The stitching happens at the `Emax` point.
Parameters
----------
... | StarcoderdataPython |
1625893 | <reponame>marcelamelara/private-data-objects
# Copyright 2018 Intel Corporation
#
# 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 r... | StarcoderdataPython |
1799750 | <filename>learnit/autolearn/functions.py
import numpy as np
import pandas as pd
from sklearn.calibration import CalibratedClassifierCV
from sklearn.metrics import auc, roc_curve, log_loss, mean_absolute_error
from sklearn.model_selection import KFold, StratifiedKFold
from sklearn.model_selection import ShuffleSplit
fro... | StarcoderdataPython |
11349435 | import numpy as np
def show_search_results(history, N):
n = history.total_num_search
index = np.argmax(history.fx[0:n])
if N == 1:
print '%04d-th step: f(x) = %f (action=%d)' \
% (n, history.fx[n-1], history.chosed_actions[n-1])
print ' current best f(x) = %f (best action=%d... | StarcoderdataPython |
9679103 | from django.shortcuts import redirect, render
from twitteruser.models import TwitterUser
from tweet.models import Tweet
from notification.models import Notifications
from django.contrib.auth.decorators import login_required
# Create your views here.
# request.user.id
# get following users id
# request.user.following
#... | StarcoderdataPython |
1728306 | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.cockroachdb import CockroachdbCheck
from datadog_checks.dev.testing import requires_py3
pytestmark = [pytest.mark.usefixtures('dd_environment'), requires_py3]
def test... | StarcoderdataPython |
4923699 | <reponame>douglasdaly/web-app-skeleton<filename>src/backend/app/utils/strutils.py
# -*- coding: utf-8 -*-
"""
String utilities.
"""
import re
def camel_to_snake(s: str) -> str:
"""Converts the given CamelCase name to snake_case.
Parameters
----------
s : str
The text to convert.
Returns
... | StarcoderdataPython |
1846592 | <filename>validate_transferability/H-score_target_task_selection.py<gh_stars>1-10
"""
This file is for showing the relationship between transferability and transfer performance under the scenario of target task selection.
"""
import numpy as np
import matplotlib.pyplot as plt
score_p = np.load('../outputs/score_p.npy'... | StarcoderdataPython |
8076168 | <reponame>guillaumeraille/darts<gh_stars>0
import shutil
import unittest
import pandas as pd
from ..models.rnn_model import _RNNModule, RNNModel
from ..timeseries import TimeSeries
class RNNModelTestCase(unittest.TestCase):
__test__ = True
times = pd.date_range('20130101', '20130410')
pd_series = pd.Ser... | StarcoderdataPython |
3432773 | <filename>nn_wtf/parameter_optimizers/__init__.py<gh_stars>0
__author__ = '<NAME> <<EMAIL>>'
| StarcoderdataPython |
4801870 | <reponame>sclarke/adventofcode2016
from collections import deque
import re
from copy import copy
test_input = list('abcde')
test_scramble = """swap position 4 with position 0
swap letter d with letter b
reverse positions 0 through 4
rotate left 1 step
move position 1 to position 4
move position 3 to position 0
rotate... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.