id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
9690358 | """*************************************************************************
* *
* Copyright (C) <NAME> - All Rights Reserved. *
* *
**********************... | StarcoderdataPython |
5012185 | <gh_stars>1-10
import os.path
class AbstractUserMap (object):
""" A UserMap is used to map an email address to a specific user's identity.
This is necessary because sometimes users have configured git with
different email addresses on different machines; as a result, we need to
define a map... | StarcoderdataPython |
6484232 | <filename>src/examples/vision/start_recording_features.py<gh_stars>1-10
import time
import subprocess
import os
import signal
import RPi.GPIO as GPIO
from aiy.vision.leds import Leds, RgbLeds
aiy_command = 'python3 /home/pi/Repositories/aiyprojects-raspbian/src/' \
'examples/vision/record_features.py'
... | StarcoderdataPython |
393624 | """
Given a singly linked list, determine if it is a palindrome.
Example 1:
Input: 1->2
Output: false
Example 2:
Input: 1->2->2->1
Output: true
Follow up:
Could you do it in O(n) time and O(1) space?
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val ... | StarcoderdataPython |
1614219 | <gh_stars>100-1000
#!/usr/bin/env python
# coding=utf8
from __future__ import unicode_literals
from datetime import timedelta
import collections
import functools
import os
import re
import string
from io import StringIO
import pytest
from hypothesis import given, settings, HealthCheck, assume
import hypothesis.strate... | StarcoderdataPython |
6470087 | my_expr = 42
s = f'foo{my_expr} bar{my_expr}' | StarcoderdataPython |
6672986 | # coding=utf-8
__author__ = 'weed'
import cv2
import numpy
import math
WHITE = (255,255,255)
RED = ( 0, 0,255)
GREEN = ( 0,128, 0)
BLUE = (255, 0, 0)
SKY_BLUE = (255,128,128)
BLACK = ( 0, 0, 0)
DARKSLATEGRAY = ( 79, 79, 47)
TEAL = (128,128, 0)
def ge... | StarcoderdataPython |
4953137 | import ZSI
import ZSI.TCcompound
import ZSI.wstools.Namespaces as NS
from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED
from ZSI.generate.pyclass import pyclass_type
##############################
# targetNamespace
# http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse... | StarcoderdataPython |
219998 | import math
import sys
import os
import time
import argparse
import pybullet as p
from .simulation import Simulation
def main():
parser = argparse.ArgumentParser(prog="onshape-to-robot-bullet")
parser.add_argument('-f', '--fixed', action='store_true')
parser.add_argument('-x', '--x', type=float, default=0... | StarcoderdataPython |
12837228 | <gh_stars>1-10
import os
import struct
from JumpScale import j
import JumpScale.baselib.serializers
j.application.start("blowfishtest")
from random import randrange
msg = ""
for i in range(1000):
msg += chr(randrange(0, 256))
key = ""
for i in range(56):
key += chr(randrange(0, 256))
# b means blowfish
... | StarcoderdataPython |
14683 | """
The container to store indexes in active learning.
Serve as the basic type of 'set' operation.
"""
# Authors: <NAME>
# License: BSD 3 clause
from __future__ import division
import collections
import copy
import numpy as np
from .multi_label_tools import check_index_multilabel, infer_label_size_multilabel, flatt... | StarcoderdataPython |
1736228 | """
Set up defaults and read sentinel.conf
"""
import sys
import os
from hatch_config import HatchConfig
default_sentinel_config = os.path.normpath(
os.path.join(os.path.dirname(__file__), '../sentinel.conf')
)
sentinel_config_file = os.environ.get('SENTINEL_CONFIG', default_sentinel_config)
sentinel_cfg = Hat... | StarcoderdataPython |
1830806 | import torch
import torchvision
from torch.utils.data import DataLoader, Subset
import pytorch_lightning as pl
import torchvision.transforms as transforms
from torchvision.datasets import ImageFolder
import os, sys
from glob import glob
import cv2
from PIL import Image
sys.path.append('../')
from celeba.dataset impor... | StarcoderdataPython |
1713153 | <gh_stars>0
from __future__ import division
from builtins import range
from future.utils import with_metaclass
import numpy as np
from numpy import newaxis as na
import abc
import copy
from scipy.special import logsumexp
from pyhsmm.util.stats import sample_discrete
try:
from pyhsmm.util.cstats import sample_mark... | StarcoderdataPython |
1611903 | <reponame>Christian-B/my_spinnaker
from collections import namedtuple
import time
from typing import NamedTuple
class Foo(object):
__slots__ = ("alpha", "beta", "gamma")
def __init__(self, alpha, beta, gamma):
self.alpha = alpha
self.beta = beta
self.gamma = gamma
Bar = namedtuple('... | StarcoderdataPython |
1996103 | <filename>test/test_functions.py
import sys
from src.functions import multiply, add
def test_multiply():
assert multiply(1, 2) == 2
assert multiply(0, 1) == 0
def test_add():
assert add(1, 1) == 2
def test_python3():
if sys.version_info[0] == 3:
assert True
else:
assert True
| StarcoderdataPython |
9694799 | from dataclasses import dataclass
from time import time
@dataclass
class SearchParams:
'''Search Params for Ceo.ca intended to get spiels.'''
channel: str = '@newswire'
filter_terms: str = 'APHA'
filter_top: int = 100
load_more: str = 'top'
original_scroll_height: str = 0
# unix timestamp i... | StarcoderdataPython |
3314005 | """ rest subsystem's configuration
- config-file schema
- settings
"""
from typing import Dict
import trafaret as T
from aiohttp import web
from servicelib.application_keys import APP_CONFIG_KEY, APP_OPENAPI_SPECS_KEY
CONFIG_SECTION_NAME = "rest"
schema = T.Dict(
{T.Key("enabled", default=True, optiona... | StarcoderdataPython |
5098780 | <reponame>imagect/imagect
from zope.interface import implementer
from collections import defaultdict
from imagect.api.opener import IOpener
import imagect.api.dataset as ds
import numpy as np
@implementer(IOpener)
class Opener(object) :
pass
# add to menu
from imagect.api.actmgr import addActFun, renameAct
@add... | StarcoderdataPython |
12842114 | <gh_stars>0
from dataclasses import dataclass
from typing import Any, Callable, Generic, Iterable, Optional, TypeVar
from .strings import StringPosition, StringPositions, to_string
__all__ = [
'Match',
'Matcher',
'MatchOption',
]
T = TypeVar('T')
@dataclass(frozen=True)
class MatchOption(Generic[T]):
... | StarcoderdataPython |
5112204 | <filename>stlearn/plotting/trajectory/local_plot.py
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d import proj3d
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import pandas as pd
import matplotlib
import numpy as np
import netw... | StarcoderdataPython |
6669255 | <gh_stars>1-10
#!/usr/bin/python
# Copyright (c) 2018 <NAME>, MIT License
"""
Save question history for all players
"""
from save_user_hist import save_user_hist
from llama_slobber import get_qhist
if __name__ == "__main__":
save_user_hist(get_qhist, 'question_data')
| StarcoderdataPython |
238420 | '''Edid helpers test module'''
from pyedid import get_edid_from_xrandr_verbose
from .data import PART_OF_XRANDR_VERBOSE_OUTPUT
def test_edid_from_xrandr_verbose_bytes():
edids = get_edid_from_xrandr_verbose(PART_OF_XRANDR_VERBOSE_OUTPUT)
assert isinstance(edids, list)
assert len(edids) == 2
for edi... | StarcoderdataPython |
6574081 | <filename>src/textscreen.py<gh_stars>0
# Copyright 2022 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | StarcoderdataPython |
176961 | # Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
191437 | <reponame>ThomasVieth/WCS-Remastered
"""
"""
## python imports
from configobj import ConfigObj
from glob import glob
from os.path import dirname, basename, isfile
## warcraft.package imports
from warcraft.item import Item
from warcraft.utility import classproperty
## __all__ declaration
modules = glob(dirname(__... | StarcoderdataPython |
6493495 | <filename>advent_2020/password_philosophy.py<gh_stars>0
import dataclasses
from typing import List
def filter_eq_func(eq):
def filter(x):
return 1 if x == eq else 0
return filter
def get_character_count(string: str, char: str):
return sum(map(filter_eq_func(char), list(string)), 0)
@dataclass... | StarcoderdataPython |
360862 | #把引入模块都放入静态区域!!!!!!!!!!!!!
#他们在的区域是堆中,因为服务一直没停,所以一直占用内存.正好是我们需要的效果!!!!!!!!!!!!!!!!!!!!
#发现会重复引入下面的库包,加一个引用计数.也不行,用locals加flag也不行!!!
"""这个文件是用于测试"""
## 如果修改了原来的模块,那么就del 然后再import?????好像还是不行.
#只能点击pycharm 里面的+号按钮,重新建立一个python console
##
if 'flag' not in locals():
flag=1
import os
GPUID = '0' ##调用GPU序号... | StarcoderdataPython |
5147525 | import numpy as np
import tensorflow as tf
from numpy import random as rnd
from numpy import testing as np_testing
import pymanopt
from pymanopt.manifolds import Product, Sphere, Stiefel
from pymanopt.solvers import TrustRegions
from ._test import TestCase
class TestProblem(TestCase):
def setUp(self):
s... | StarcoderdataPython |
3203703 | #!/usr/bin/env python
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
from wandplus.textutil import calcSuitableFontsize
# http://www.imagemagick.org/Usage/text/
# original imagemagick command:
# convert -background white -fill dodgerblue -font Candice \
# -strok... | StarcoderdataPython |
5076484 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-17 23:54
from __future__ import unicode_literals
import c3nav.mapdata.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0021_... | StarcoderdataPython |
3342062 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'WhereforeGUI.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# 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 doing.
from PyQt5... | StarcoderdataPython |
1654826 | """ API Endpont """
from http.server import BaseHTTPRequestHandler
import json
from datetime import datetime
import pytz
# pylint: disable=import-error
from api._utils import scrap_data
try:
data = scrap_data.get_data()
res = {
'notice': 'endpoint is deprecated, please use /api/v2',
'lastUpdate': data['las... | StarcoderdataPython |
8028066 | <reponame>dataiku/plugin-finbert
# Code for custom code recipe fb2021 (imported from a Python recipe)
# To finish creating your custom recipe from your original PySpark recipe, you need to:
# - Declare the input and output roles in recipe.json
# - Replace the dataset names by roles access in your code
# - Declare, ... | StarcoderdataPython |
367417 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import pygame as pg
import fill
from ui import Button, GameTable
from event import ClickEventListen
ZOOM = 1
WINDOW_SIZE = (int(580 * ZOOM), int(340 * ZOOM))
ORIGIN_POINT = (int(20 * ZOOM), int(20 * ZOOM))
TABLE_SIZE = (15, 15)
BLOCK_SIZE = int(20 * ZOOM)
BLOCK_... | StarcoderdataPython |
3547157 | import numpy as np
from datetime import timedelta
from distutils.version import LooseVersion
import pandas as pd
import pandas.util.testing as tm
from pandas import to_timedelta
from pandas.util.testing import assert_series_equal, assert_frame_equal
from pandas import (Series, Timedelta, DataFrame, Timestamp, Timedelt... | StarcoderdataPython |
8086774 | import csv
import hashlib
import logging
import shutil
from datetime import datetime, timedelta
from ntpath import basename
from typing import Dict
from colorama import Fore
from dateutil import parser
from scp import SCPException
from sauronx import append_log_to_submission_log, stamp
from .alive import SauronxAliv... | StarcoderdataPython |
9610266 | # -*- coding: utf-8 -*-
import json
import boto3
import requests
from api.rdb.config import is_test, is_production
from api.rdb.utils.apigateway import get_api_url
from api.rdb.utils.service_framework import STATUS_OK
from ..utilities import invoke, get_lambda_test_data, get_lambda_fullpath
# noinspection PyUnused... | StarcoderdataPython |
119091 | import unittest
class TestCanary(unittest.TestCase):
def test_add_one_two(self):
self.assertEqual(3, 1 + 2)
| StarcoderdataPython |
1860161 | #!/usr/bin/env python3
import errno
import os.path
import re
import shlex
import stat
import string
import sys
from typing import IO
from typing import List
from typing import Optional
from typing import Set
from typing import Tuple
EXTENSIONS = {
'adoc': {'text', 'asciidoc'},
'asciidoc': {'text', 'asciidoc'}... | StarcoderdataPython |
8148835 | <gh_stars>0
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | StarcoderdataPython |
4894426 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Little example on how to use a recurrent neural network to predict a math function
Reference: https://www.datatechnotes.com/2018/12/rnn-example-with-keras-simplernn-in.html
'''
# from NumPyNet.layers.input_layer import Input_layer
from NumPyNet.layers.rnn_layer impor... | StarcoderdataPython |
1666717 | from piservices import PiService
import pios.recovery
class OsService(PiService):
name = "os"
apt_get_install = [ 'unzip', 'zip', 'curl', 'ntp', 'ntpdate', 'git-core', 'git', 'wget',
'ca-certificates', 'binutils', 'raspi-config', 'mc', 'vim', 'vim-nox',
'htop'... | StarcoderdataPython |
1910025 | {
"targets": [
{
"target_name": "nlopt",
"sources": [ "nlopt.cc" ],
"include_dirs": [
"./nlopt-2.3/api/"
],
"dependencies": [
"./nlopt-2.3/nlopt.gyp:nloptlib"
]
}
]
}
| StarcoderdataPython |
257123 | <filename>back/to_do/migrations/0003_auto_20201013_0149.py
# Generated by Django 3.1.2 on 2020-10-13 01:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('to_do', '0002_auto_20200924_2002'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
1632682 | """Automation classes for use with AppDaemon, Climate and Fan Mqtt automations.
.. codeauthor:: <NAME> <<EMAIL>>
"""
from typing import Dict, Optional
import appdaemon.plugins.hass.hassapi as hass
import ir_packets_manager
import little_helpers
class HandleMqttFan(hass.Hass):
"""Automation for con... | StarcoderdataPython |
1833208 | <filename>coils/__init__.py<gh_stars>1-10
from .Averager import Averager
from .MapSock import MapSockServer, MapSockClient, MapSockRequest
from .RateTicker import RateTicker
from .Ring import Ring
from .SocketTalk import SocketTalk
from .SortedList import SortedList
from .String import string2time, time2string, time2le... | StarcoderdataPython |
6586493 | import pexpect
host = '172.16.31.10'
username = 'pyclass'
password = '<PASSWORD>'
def send(ssh_connection, command, expect):
ssh_connection.sendline(command)
ssh_connection.expect(prompt)
ssh_connection = pexpect.spawn('ssh -l {} {}'.format(username, host))
ssh_connection.timeout = 3
ssh_connection.expect('... | StarcoderdataPython |
9791012 | <filename>lightning_run.py
import os
import argparse
import torch
import torch.optim as optim
import torch.nn as nn
from torchvision import datasets
from torchvision import transforms
import pytorch_lightning as pl
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbacks import ModelCh... | StarcoderdataPython |
157666 | # Copyright (c) OpenMMLab. All rights reserved.
from .builder import build_linear_layer, build_transformer
from .conv_upsample import ConvUpsample
from .csp_layer import CSPLayer
from .gaussian_target import gaussian_radius, gen_gaussian_target
from .inverted_residual import InvertedResidual
from .make_divisible ... | StarcoderdataPython |
3410483 | from DirectVOLayer import DirectVO
from networks import VggDepthEstimator, PoseNet, PoseExpNet
from ImagePyramid import ImagePyramidLayer
import torch.nn as nn
import torch
from torch.autograd import Variable
import numpy as np
import itertools
from timeit import default_timer as timer
class FlipLR(nn.Module):
d... | StarcoderdataPython |
3358918 | <filename>source/suspension/package/WCRT.py
import math
from functions import *
def WCRT(CS,Tn,HPTasks):
R=0
while True:
if R> Tn:
return R
I=0
for itask in HPTasks:
I=I+Workload_w_C(itask['period'],itask['execution'],itask['period'],R)
if I+CS>R:
R=I+CS
else:
return R
| StarcoderdataPython |
9752721 | <reponame>jacebrowning/slackoff
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned,singleton-comparison
from slackoff import slack
def describe_signout():
def it_indicates_success(expect):
expect(slack.signout("Foobar")) == False
| StarcoderdataPython |
9760184 | <filename>main.py
# import "packages" from flask
import json
# import app as app
from flask import render_template, redirect, request, url_for, send_from_directory
from flask_login import login_required
from __init__ import app, login_manager
from cruddy.app_crud import app_crud
from cruddy.app_crud_api import app_cr... | StarcoderdataPython |
358892 | import pandas as pd
import parserExcel as parser
import xgboost as xgb
import classification as csf
db = parser.getDataFramefromExcel("./BPDdataset.csv")
# Remodel dataset
# Order columns like
# other, outcome, possible early risk factors, possible late risk factors
db = parser.orderColumns(db)
# Drop some ininflu... | StarcoderdataPython |
6495452 | <reponame>gretelai/safe-location-density
from typing import List
import requests
import pandas as pd
GBFS_FEEDS = [
"https://mds.bird.co/gbfs/v2/public/los-angeles/free_bike_status.json",
"https://s3.amazonaws.com/lyft-lastmile-production-iad/lbs/lax/free_bike_status.json", # noqa
"https://gbfs.spin.pm/... | StarcoderdataPython |
3392606 | from enum import Enum
class CardType(Enum):
NONE = -1
DEV = 0
AGILE_COACH = 1
HR = 2
PM = 3
ACTION = 4
KNOWLEDGE = 5
| StarcoderdataPython |
4876109 | #!/usr/bin/python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... | StarcoderdataPython |
24425 | from __future__ import print_function
import os
import re
def openFile(f, m='r'):
if (os.path.exists(f)):
return open(f, m)
else:
return open('../' + f, m)
demo_test = ' '.join(openFile('mockito_test/demo_test.py').readlines())
demo_test = demo_test.split('#DELIMINATOR')[1]
readme_before = ''.join(... | StarcoderdataPython |
8001482 | <filename>day-01.py
def fuel_requirement(mass):
fuel = mass // 3 - 2
return fuel if fuel>0 else 0
# Part 1
with open("input-01.txt") as f:
total_fuel_requirement = sum(fuel_requirement(int(mass)) for mass in f)
print(total_fuel_requirement)
# Part 2
def rec_fuel_requirement(mass):
if mass <= 0:
... | StarcoderdataPython |
8064875 | <filename>src/pymodaq_plugins_newport/daq_move_plugins/daq_move_Newport_AgilisSerial.py
from pymodaq.daq_move.utility_classes import DAQ_Move_base, comon_parameters, main
from pymodaq.daq_utils.daq_utils import ThreadCommand, getLineInfo, set_logger, get_module_name
from easydict import EasyDict as edict
from pymodaq_... | StarcoderdataPython |
3556844 | from singlecellmultiomics.utils.sequtils import reverse_complement
from singlecellmultiomics.fragment import Fragment
class ScarTraceFragment(Fragment):
"""
Fragment definition for ScarTrace
"""
def __init__(self, reads,scartrace_r1_primers=None, **kwargs):
Fragment.__init__(self, reads, **kw... | StarcoderdataPython |
11384354 | <reponame>simondolle/dgim
import unittest
import itertools
from collections import deque
from dgim import Dgim
from dgim.utils import generate_random_stream
class ExactAlgorithm(object):
"""Exact algorithm to count the number of "True"
in the last N elements of a boolean stream."""
def __init__(self, N):... | StarcoderdataPython |
6663776 | <gh_stars>0
# -*- coding: utf-8 -*-
import os
import approvaltests
from approvaltests.reporters import PythonNativeReporter
from pytest_approvaltests import get_reporter, clean, pytest_configure
def test_approvaltests_use_reporter(testdir):
# create a temporary pytest test module with a failing approval test
... | StarcoderdataPython |
4879740 | # Generated by Django 2.2.5 on 2019-10-07 17:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0021_auto_20191007_1739'),
]
operations = [
migrations.AlterField(
model_name='order',
name='deliveredOn',
... | StarcoderdataPython |
4882860 | # [Shaolin Temple] Investigate the Sutra Repository
BOOK_OF_DEMONS = 4034637
WISE_CHIEF_PRIEST = 9310053
sm.removeEscapeButton()
sm.setSpeakerID(WISE_CHIEF_PRIEST)
sm.setBoxChat()
sm.sendNext("Oh! The #bBook of Demons#k! You didn't... You didn't open the book, did you?")
sm.flipBoxChat()
sm.flipBoxChatPlayerAsSpeake... | StarcoderdataPython |
1616709 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 29 13:15:30 2021
http://www.kitconet.com/
@author: haoli
"""
commodityDir = "./data"
commodityShanghaiDir = commodityDir + "/Shanghai" #"./data/LME"
commodityShanghai_dataDir = commodityShanghaiDir + "/temp" #"./data/LME/temp"
commodityShanghaiDir_OIVolP... | StarcoderdataPython |
5037200 | import os, sys; sys.path.insert(0, os.path.join("..", ".."))
from pattern.vector import Document, Corpus
# Latent Semantic Analysis (LSA) is a statistical machine learning method
# based on a matrix calculation called "singular value decomposition" (SVD).
# It discovers semantically related words across documents.
#... | StarcoderdataPython |
1667207 | <reponame>andela-cnnadi/python-fire
from functools import wraps
def validate_payload(func):
@wraps(func)
def func_wrapper(instance, payload):
native_types = [bool, int, float, str, list, tuple, dict]
if type(payload) not in native_types:
raise ValueError("Invalid payload specified"... | StarcoderdataPython |
3436284 | <reponame>ahmeddeladly/arch
"""
Simulation of ADF z-test critical values. Closely follows MacKinnon (2010).
Running this files requires an IPython cluster, which is assumed to be
on the local machine. This can be started using a command similar to
ipcluster start -n 4
Remote clusters can be used by modifying th... | StarcoderdataPython |
8054377 | <gh_stars>1-10
__author__ = "konwar.m"
__copyright__ = "Copyright 2022, AI R&D"
__credits__ = ["konwar.m"]
__license__ = "Individual Ownership"
__version__ = "1.0.1"
__maintainer__ = "konwar.m"
__email__ = "<EMAIL>"
__status__ = "Development"
import numpy as np
import tensorflow as tf
from tensorflow import keras
from... | StarcoderdataPython |
295304 | import numpy as NP
from scipy import signal
from scipy import interpolate
import mathops as OPS
import lookup_operations as LKP
#################################################################################
def unwrap_FFT2D(arg, **kwarg):
return NP.fft.fft2(*arg, **kwarg)
def unwrap_IFFT2D(arg, **kwarg):
... | StarcoderdataPython |
317721 | from rest_framework.viewsets import ModelViewSet
from content.api.serializer import ListProductSerializer, DetailProductSerializer
from content.models import Products
class ProductViewset(ModelViewSet):
queryset = Products.objects.all()
def get_serializer_class(self):
if self.action == 'list':
... | StarcoderdataPython |
9719996 | from tests.integration.create_token import create_token
from tests.integration.integration_test_case import IntegrationTestCase
from tests.integration.mci import mci_test_urls
class TestEmptyQuestionnaire(IntegrationTestCase):
def test_empty_questionnaire(self):
# Get a token
token = create_token... | StarcoderdataPython |
4947782 | from django.contrib import admin
from django.urls import path, include
from rest_framework.authtoken import views
from api.urls import router
from element.views.element_wiews import ElementListView
# 网站标签页名称
admin.site.site_title = '北斗后台管理'
# 网站名称:显示在登录页和首页
admin.site.site_header = '北斗后台管理'
urlpatterns = [
path... | StarcoderdataPython |
149786 | <gh_stars>1-10
import selenium
from functions.Functions import Functions as Selenium
import unittest
from classes.FormLogin import EventLogin
from classes.FormTerminosCondiciones import EventTerminosCondiciones as EventTC
class TratamientoDatos(Selenium,unittest.TestCase):
def setUp(self):
Selenium.abrir_... | StarcoderdataPython |
1734714 | import napari
import dask.array as da
import zarr
import tifffile
def lazy_view(
tiff_path, channel_names=None, colormaps=None, viewer=None,
channel_from_to=(None, None)
):
target_filepath = tiff_path
# workaround for Faas pyramid
tiff = tifffile.TiffFile(target_filepath, is_ome=False)... | StarcoderdataPython |
1648833 | <reponame>InesPessoa/datascience-challenger
from flask import Flask
from flask_cors import CORS
import json
app = Flask(__name__)
CORS(app, resources={r"*": {"origins": "http://localhost:3000"}})
@app.route('/')
def hello_world():
return 'Hello World!'
@app.route('/questions', methods=["GET"])
def get_question... | StarcoderdataPython |
633 | import tensorflow
from tensorflow import keras
Model = keras.models.Model
Dense = keras.layers.Dense
Activation = keras.layers.Activation
Flatten = keras.layers.Flatten
BatchNormalization= keras.layers.BatchNormalization
Conv2D = tensorflow.keras.layers.Conv2D
AveragePooling2D = keras.layers.AveragePooling2D
I... | StarcoderdataPython |
3535929 | # pylint: disable=C0103,E0401,R0913,C0330,too-many-locals
"""
JFSP app.
See gui.py for the Dash components and GUI.
See luts.py for the lookup tables which drive both the data ingest and GUI.
See preprocess.py for the data structure that this code assumes!
"""
import os
import math
import plotly.graph_objs as go
from... | StarcoderdataPython |
4932011 | <gh_stars>1-10
import numpy as np
from mmdet.core.evaluation.mean_ap import (eval_map, tpfp_default,
tpfp_imagenet, tpfp_openimages)
det_bboxes = np.array([
[0, 0, 10, 10],
[10, 10, 20, 20],
[32, 32, 38, 42],
])
gt_bboxes = np.array([[0, 0, 10, 20], [0, 10, 10, 1... | StarcoderdataPython |
1803718 | #!/usr/bin/env python
#
# !!! Needs psutil (+ dependencies) installing:
#
# $ sudo apt-get install python-dev
# $ sudo pip install psutil
#
import os
import sys
import fluidsynth_backend
import sys
from time import sleep
if os.name != 'posix':
sys.exit('platform not supported')
import psutil
from datetime ... | StarcoderdataPython |
1887896 | # Copyright 2017, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
9657814 | '''
Created on Jun 12, 2017
@author: xinguan
'''
import mysql_inserter
import mysql.connector
################################ START database configuration ########################
host = 'localhost'
user = 'root'
password = '<PASSWORD>'
db = 'dice_test'
conn = mysql.connector.connect(user=user, password=password, ... | StarcoderdataPython |
3455582 | <reponame>sahilvora225/nursery-store
from rest_framework import serializers
from plant.models import Plant
from .models import Order
class OrderSerializer(serializers.ModelSerializer):
"""
Serializer for Order model.
"""
buyer = serializers.PrimaryKeyRelatedField(read_only=True)
plant = serializ... | StarcoderdataPython |
5109884 | from pyOER import StandardExperiment
import numpy as np
from matplotlib import pyplot as plt
forpublication = True
if forpublication: # for the publication figure
import matplotlib as mpl
mpl.rcParams["figure.figsize"] = (3.25, 2.75)
# plt.rc('text', usetex=True) # crashingly slow
plt.rc("font", fam... | StarcoderdataPython |
3343431 | <reponame>paulkarikari/PyDP
import pydp as dp
print("Successfully imported pydp")
# print("Here are the available Status codes from the Base library")
# x = range(18)
# for n in x:
# print(pd.StatusCode(n))
s = dp.Status(dp.Status.StatusCode(3), "New status object")
print(s)
url = "http://test.com"
payload_cont... | StarcoderdataPython |
3239910 | import numpy as np
from extensive_form.optimistic_ulcb import OptimisticULCB
from extensive_form.strategic_ulcb import StrategicULCB
from extensive_form.optimistic_nash_q import OptimisticNashQ
from extensive_form.optimistic_nash_v import OptimisticNashV
from extensive_form.uniform_exploration import UniformExploratio... | StarcoderdataPython |
4993414 | """ Purpose: Automatic Speech Recognition module using Google's speech recognition
Source Code Creator: <NAME>
Project: WILPS Hamburg University
Term: Summer 2021
M.Sc. Intelligent Adaptive Systems """
from utils.getMeetingInfo import getcurrentMeetingInfo
from utils.chunkAudio import chuckAudio
from utils.convertTo... | StarcoderdataPython |
5010966 | from .fgir import *
from .error import *
# Optimization pass interfaces
class Optimization(object):
def visit(self, obj): pass
class FlowgraphOptimization(Optimization):
'''Called on each flowgraph in a FGIR.
May modify the flowgraph by adding or removing nodes (return a new Flowgraph).
If you modify nodes, ... | StarcoderdataPython |
3581132 | <filename>shibayama2009.py
import sympy
import Hamilton
import Birkhoff
x = sympy.IndexedBase("x")
y = sympy.IndexedBase("y")
p = sympy.IndexedBase("p")
q = sympy.IndexedBase("q")
t = sympy.IndexedBase("tau")
o = sympy.Symbol("omega", positive=True)
a = sympy.Symbol("alpha", positive=True)
b = sympy.Symbol("beta")
l =... | StarcoderdataPython |
6543142 | <filename>fetch_all_exp.py
import neptune
from config import EnvConfig
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
comet_cfg = EnvConfig()
session = neptune.Session(api_token=comet_cfg.neptune_token)
project = session.get_project(project_qualified_name... | StarcoderdataPython |
332133 | <gh_stars>10-100
#!/usr/env/bin/env python
# A script to convert various types of raster images into .tiff format
# that can be easier for MATLAB to read
# Refer to this question:
# https://gis.stackexchange.com/questions/42584/how-to-call-gdal-translate-from-python-code
# and this one: https://gdal.org/tutorials/rast... | StarcoderdataPython |
5195352 | <filename>src/auxil/readshp.py
#!/usr/bin/env python
# Name: readshp.py
# Purpose:
# Read ENVI ROI shapefiles and return training/test data and class labels
# Usage:
# import readshp
# Gs, ls, numclasses = readshp.readshp(<train shapefile>, <inDataset for image>, <band positions)> )
from osgeo impo... | StarcoderdataPython |
6496516 | """ Module RxNSEM.py
Receivers for the NSEM problem
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from scipy.constants import mu_0
import SimPEG
import numpy as np
from SimPEG import mkvc
class BaseRxNSEM_Point(SimPEG.Survey.BaseRx):
"""
N... | StarcoderdataPython |
4914055 | <filename>test_graphlib.py
import itertools
from typing import Any, Collection, Dict, Generator, Hashable, Iterable, Sequence, Set, TypeVar
import sys
if sys.version_info < (3, 8):
from typing_extensions import Protocol
else:
from typing import Protocol
import graphlib2 as graphlib
import pytest
class Node(H... | StarcoderdataPython |
12818109 | <reponame>harmonica-pacil/invid19
from django.db import models
from users.models import Profile
class Forum(models.Model):
title = models.CharField(max_length=50)
message = models.TextField()
creator = models.ForeignKey(Profile, on_delete=models.CASCADE, blank = True, null = True)
created_at = models.C... | StarcoderdataPython |
3215479 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: <NAME>
## Computer Vision Center (CVC). Universitat Autonoma de Barcelona
## Email: <EMAIL>
## Copyright (c) 2017
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the root directory o... | StarcoderdataPython |
1736773 | import bcrypt
from flask import Blueprint, render_template, redirect, request, flash
from flask.helpers import url_for
from flask_login import current_user, LoginManager, login_user, logout_user
from flask_login.utils import login_required
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.fie... | StarcoderdataPython |
3590319 | <reponame>cahudson94/Raven-Valley-Forge-Shop
# Generated by Django 2.0 on 2018-02-05 03:02
from django.db import migrations, models
import sorl.thumbnail.fields
class Migration(migrations.Migration):
dependencies = [
('catalog', '0009_remove_product_shipping_info'),
]
operations = [
mig... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.