id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6533912 | <reponame>EchoRickZz/DeepST<filename>deepst/utils/viewRetFromPkl.py
#!/usr/bin/env python
# encoding: utf-8
import sys
import cPickle as pickle
def view(fname):
pkl = pickle.load(open(fname, 'rb'))
for ke in pkl.keys():
print ('=' * 10)
print (ke)
print (pkl[ke])
view(sys.argv[1])
| StarcoderdataPython |
23932 | <reponame>JakubBatel/Attendance-Recorder<filename>src/attendance/card_reader.py
from .resources.config import config
from .utils import reverse_endianness
from abc import ABC
from abc import abstractmethod
from logging import getLogger
from logging import Logger
from time import sleep
from typing import Final
import ... | StarcoderdataPython |
229097 | ##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2019 <NAME> <<EMAIL>>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at... | StarcoderdataPython |
8198804 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 7 10:31:00 2016
@author: roel
"""
from opengrid_dev import ureg
import pandas as pd
from dateutil import rrule
import datetime as dt
from itertools import groupby, count
import pytz
def parse_date(d):
"""
Return a pandas.Timestamp if possible.
Parame... | StarcoderdataPython |
3302419 | # pylint:disable=invalid-name,missing-docstring,too-few-public-methods,redefined-builtin
from __future__ import print_function
from linthints import adds_arguments, sets_arguments
import sys
def bogus_dec(func):
def inner(*args, **kwargs):
return func(*args, **kwargs)
return inner
@adds_arguments(fil... | StarcoderdataPython |
1638442 | # Generated by Django 2.0.8 on 2018-08-12 21:47
from django.db import migrations
import i18nfield.fields
class Migration(migrations.Migration):
dependencies = [
("submission", "0026_auto_20180811_1827"),
]
operations = [
migrations.AlterField(
model_name="question",
... | StarcoderdataPython |
60599 | <gh_stars>0
import os
import numpy as np
class ForceField(object):
def __init__(self):
self.atomtypes = []
self.pairtypes = []
self.bondtypes = []
self.constrainttypes = []
self.angletypes = []
self.dihedraltypes = []
self.implicit_genborn_params = []
... | StarcoderdataPython |
12802076 | from multiprocessing import Process, Queue
from datetime import datetime as dt
import time
import os
class Worker(Process):
def __init__(self, q):
Process.__init__(self)
self.q: Queue = q
def run(self):
while True:
if not self.q.empty():
break
i... | StarcoderdataPython |
5102627 | <reponame>kgresearch/models
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | StarcoderdataPython |
395161 | """
Copyright 2020 The Johns Hopkins University Applied Physics Laboratory LLC
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unles... | StarcoderdataPython |
12864409 | <reponame>erogleva/core
"""eafm fixtures."""
import pytest
from tests.async_mock import patch
@pytest.fixture()
def mock_get_stations():
"""Mock aioeafm.get_stations."""
with patch("homeassistant.components.eafm.config_flow.get_stations") as patched:
yield patched
@pytest.fixture()
def mock_get_st... | StarcoderdataPython |
11343678 | import tempfile
from threatexchange.cli.tests.e2e_test_helper import ThreatExchangeCLIE2eTest
from threatexchange.signal_type.md5 import VideoMD5Signal
class MatchCommandTest(ThreatExchangeCLIE2eTest):
COMMON_CALL_ARGS = ("match",)
def test_file_noexst(self):
self.assert_cli_usage_error(("text", "do... | StarcoderdataPython |
1886137 | # views.py — accounts views
#
# This file is part of debexpo -
# https://salsa.debian.org/mentors.debian.net-team/debexpo
#
# Copyright © 2008 <NAME> <<EMAIL>>
# Copyright © 2010 <NAME> <<EMAIL>>
# Copyright © 2019 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person
# obtain... | StarcoderdataPython |
5122935 | #!/usr/bin/python
#
# Adapted from: https://github.com/mcordts/cityscapesScripts
#
# The evaluation script for pixel-level semantic labeling.
# We use this script to evaluate your approach on the test set.
# You can use the script to evaluate on the validation set.
#
# usage: evalPixelLevelSemanticLabeling.py --gt_path... | StarcoderdataPython |
57225 | import os
import pytest
from io import StringIO
pytest.register_assert_rewrite('tests.common')
@pytest.fixture
def content():
def _reader(filename):
with open(filename) as f:
return f.read()
return _reader
@pytest.fixture
def expected(request):
filename = os.path.splitext(request... | StarcoderdataPython |
11381425 | <reponame>gaybro8777/osf.io
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-03-06 16:48
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
import osf.utils.datetime_aware_jso... | StarcoderdataPython |
373535 | from shaape.overlayparser import OverlayParser
from shaape.node import Node
from shaape.opengraph import OpenGraph
from shaape.polygon import Polygon
import nose
import unittest
from nose.tools import *
class TestOverlayParser(unittest.TestCase):
def test_init(self):
parser = OverlayParser()
asser... | StarcoderdataPython |
9635754 | # Copyright (c) IBM Corp. 2018. All Rights Reserved.
# Project name: Constrained Exploration and Recovery from Experience Shaping
# This project is licensed under the MIT License, see LICENSE
from baselines import logger
import baselines.common.tf_util as U
import numpy as np
import time
from mpi4py import MPI
import ... | StarcoderdataPython |
11247792 | <reponame>medunigraz/outpost.django.attendance
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-07-14 19:59
from __future__ import unicode_literals
from django.db import migrations, models
from ...base.fields import ChoiceArrayField
class Migration(migrations.Migration):
dependencies = [("attendanc... | StarcoderdataPython |
3529534 | CORRECT_OPTION_TAG = "correct_option"
INCORRECT_OPTION_TAG = "incorrect_option"
CORRECT_OPTION_GOLD_TAG = "gold"
CORRECT_OPTION_TAG_LIST = [CORRECT_OPTION_TAG, CORRECT_OPTION_GOLD_TAG]
ALL_OPTION_TAG_LIST = [
CORRECT_OPTION_TAG,
CORRECT_OPTION_GOLD_TAG,
INCORRECT_OPTION_TAG,
]
| StarcoderdataPython |
1795679 | """
seqgra evaluator hierarchy - gradient-based feature importance evaluators (FIE)
Classes:
- :class:`~seqgra.evaluator.gradientbased.gradientbasedevaluator.GradientBasedEvaluator`: abstract class for all gradient-based feature importance evaluators
- :class:`~seqgra.evaluator.gradientbased.abstractdifference... | StarcoderdataPython |
3417097 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-21 13:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0003_auto_20190121_1307'),
]
operations = [
mi... | StarcoderdataPython |
4870868 | # -*- coding: utf-8 -*-
import os
import time
import unittest
from configparser import ConfigParser
import inspect
import copy
import requests as _requests
from unittest.mock import patch
from AbstractHandle.AbstractHandleImpl import AbstractHandle
from AbstractHandle.AbstractHandleServer import MethodContext
from Abs... | StarcoderdataPython |
8088706 | <filename>beanie/odm/settings/document.py<gh_stars>0
import warnings
from typing import Optional, Type, List
from motor.motor_asyncio import AsyncIOMotorDatabase
from pydantic import Field
from pymongo import IndexModel
from beanie.exceptions import MongoDBVersionError
from beanie.odm.settings.base import ItemSetting... | StarcoderdataPython |
5036366 | <reponame>dmcinerney/Summarization
import torch
from torch import nn
from torch.nn import functional as F
from models.beam_search import beam_search
from models.submodules import LSTMTextEncoder, CombineContext, LSTMSummaryDecoder, ContextVectorNN, VocabularyDistributionNN, ProbabilityNN
from models.model_helpers impor... | StarcoderdataPython |
11229620 | <filename>api/exceptions.py<gh_stars>0
# TODO
class DatasourceBaseError(Exception):
pass
class DatasourceBadObjectError(DatasourceBaseError):
pass
class DatasourceObjectParseError(DatasourceBaseError):
pass
class DatasourceBadParameterTypeError(DatasourceBaseError):
"""Raised when a parameter or... | StarcoderdataPython |
152847 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | StarcoderdataPython |
11212155 |
COMMANDS = ['version']
HELP = {
'version': 'Print the framework version'
}
def execute(**kargs):
env = kargs.get("env")
showLogo = kargs.get("showLogo")
# If we've shown the logo, then the version has already been printed
if not showLogo:
print(env["version"])
| StarcoderdataPython |
1635552 | <reponame>MichalKyjovsky/NPRG065_Programing_in_Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import collections
class OrderedAttributes(type):
"""
Classes created from this metaclass will remember the order in which the attributes are created
"""
@classmethod
def __prepare__(metacls, nam... | StarcoderdataPython |
3297118 | from pythonds.basic import Stack
def postfixEval(postfixExpr):
operandStack = Stack()
tokenList = postfixExpr.split()
for token in tokenList:
if token in "0123456789":
operandStack.push(int(token))
else:
operand2 = operandStack.pop()
operand1 = operandSt... | StarcoderdataPython |
4968717 | <filename>reeds/tests/pipeline_test/PNMT_WATER_PIPELINE/c_job_eoff_estm.py
#!/usr/bin/env python3
import os, sys, glob
from reeds.modules import do_RE_EDS_eoffEstimation as eoffEstm
sys.path.append(os.getcwd())
from global_definitions import fM, bash
from global_definitions import name, root_dir
from global_definiti... | StarcoderdataPython |
11227325 | # Generated by Django 2.1.1 on 2018-10-16 11:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('webapp', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='recomendacao',
fields=[
('i... | StarcoderdataPython |
4937053 | <gh_stars>10-100
from abc import ABC, abstractmethod
from argparse import Namespace
from typing import Any, Dict, List, Optional, Tuple, Union, cast
import pytorch_lightning as pl
import torch
import torch.nn as nn
from loguru import logger
from omegaconf import DictConfig
from slp.config.omegaconf import OmegaConf
fr... | StarcoderdataPython |
258345 | <reponame>maneeshd/braintree_python
import braintree
import warnings
from decimal import Decimal
from braintree.add_on import AddOn
from braintree.apple_pay_card import ApplePayCard
from braintree.authorization_adjustment import AuthorizationAdjustment
from braintree.coinbase_account import CoinbaseAccount
from braintr... | StarcoderdataPython |
1839905 | #!python
import string
# Hint: Use these string constants to encode/decode hexadecimal digits and more
# string.digits is '0123456789'
# string.hexdigits is '0123456789abcdefABCDEF'
# string.ascii_lowercase is 'abcdefghijklmnopqrstuvwxyz'
# string.ascii_uppercase is 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# string.ascii_letters... | StarcoderdataPython |
1729309 | <reponame>jjandnn/ROMP
from os import remove
from sklearn.model_selection import PredefinedSplit
import torch
import sys
def remove_prefix(state_dict, prefix='module.', remove_keys=['_result_parser', '_calc_loss']):
keys = list(state_dict.keys())
print('orginal keys:', keys)
for key in keys:
exist_... | StarcoderdataPython |
1909849 | # get CPU/GPU RAM usage reports like:
# Gen RAM Free: 11.6 GB | Proc size: 666.0 MB
# GPU RAM Free: 566MB | Used: 10873MB | Util 95% | Total 11439MB
# needed on google colab
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi
# memory footprint support libraries/code
!pip install gputil
!pip install psutil
!pip install... | StarcoderdataPython |
168977 | <reponame>CaptainDario/ETLCDB_data_reader
import sys
import os
import time
sys.path.append(os.path.abspath(os.getcwd()))
from etldr.etl_data_reader import ETLDataReader
def load_one_data_set_file(reader : ETLDataReader):
"""The first example of the README.
Args:
reader : ETLDataReader instance to l... | StarcoderdataPython |
5092093 | <reponame>mvalente/hub2tweet
from google.appengine.ext import db
"""Data models for hub2tweet."""
# Note on OAuthConfig:
#
# The configuration is stored in datastore as we don't want to check our
# private keys into an open source project. The first config in the
# datastore will be used.
#
# To help make this easi... | StarcoderdataPython |
4999716 | import array
import itertools
def make_bytearray(n, undefined_value):
return array.array('B', itertools.repeat(undefined_value, n))
class SparseBytes():
""" A page-based sparse array. The content is backed by a dict() (of array.array('B') by default)"""
def __init__(self, pagesize=4096, undefined_value... | StarcoderdataPython |
11295395 | <reponame>MarcosRibas/Projeto100Exercicios
#Ex050 Desenvolva um programa que leia seis números inteiros e mostre a soma apenas daqueles que forem pares.
# Se o valor digitado for ímpar, desconsidere-o.
par = 0;
for c in range(1, 7):
num = int(input('Digite um número: '))
if num % 2 == 0:
par = par + num... | StarcoderdataPython |
5185122 | <gh_stars>1-10
from absl.testing import absltest
from matplotlib import pyplot
import networkx as nx
from oblique import extmodule
from oblique import nxutils
class ApiTests(absltest.TestCase):
def test_convert_to_nx(self):
db = extmodule.parse_string("""\
Conquer the world.
""")
g = nxutils.c... | StarcoderdataPython |
4993549 | # MIT License
#
# Copyright (c) 2021 TrigonDev
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | StarcoderdataPython |
3494993 | # Copyright 2019 Open Source Robotics Foundation, 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... | StarcoderdataPython |
11232364 | <reponame>kiteco/kiteco-public
import json
import string
def main():
with open("report.txt", "r") as fp:
template = string.Template(fp.read())
with open("params.json", "r") as fp:
params = json.load(fp)
lines = [
"parameter|value",
"-|-",
]
lines.extend(f"{param}|... | StarcoderdataPython |
6572736 | <reponame>nkenealy/shopify-product-load<filename>app/api_1_0/variants.py
from flask import jsonify, request, g, url_for, current_app
from .. import db
from ..models import Post, Permission, Product, Variant, Image
from . import api
from .decorators import permission_required
import logging
@api.route('/variants/')
de... | StarcoderdataPython |
1940855 | from django.urls import path
from rango import views
app_name = 'rango'
urlpatterns = [
path('', views.index, name='index'),
path('about/', views.about, name='about'),
path('category/<slug:category_name_slug>/',
views.show_category, name='show_category'),
path('add_category/', views.add_cate... | StarcoderdataPython |
8024552 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: DeepSeaVectorDraw
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class Color(object):
__slots__ = ['_tab']
@classmethod
def SizeOf(cls):
return 4
# Color
def Init(self, ... | StarcoderdataPython |
5075603 | <reponame>Philipnah/DailyCodingProblem<filename>Problem4[Medium]/main.py
searchQuery = input("Query: ")
stringArray = ["dog", "deer", "deal"]
cut = len(searchQuery)
cutArray = []
i = 0
while i < len(stringArray):
cutArray.append(stringArray[i][:cut])
i += 1
response = []
i = 0
while i < len(cutArray):
... | StarcoderdataPython |
4889322 | <reponame>Qiwen-Yu/cool_ssg_generator<filename>cool_ssg/utils/config_util.py<gh_stars>0
from pathlib import Path
import json
import sys
def get_config(config_path, options):
if Path(config_path).exists() and config_path.endswith(".json"):
loadedConfig = json.load(open(config_path, "r"))
if "input"... | StarcoderdataPython |
5184903 | <gh_stars>0
## import the necessary packages
from imutils.perspective import four_point_transform
from imutils import contours
import imutils
import cv2
import numpy as np
def measure():
# define the dictionary of digit segments so we can identify
# each digit on the thermostat
DIGITS_LOOKUP = {
(1, 1, 1, 0, 1,... | StarcoderdataPython |
41954 | <reponame>ventris/tateru<gh_stars>0
#!/usr/bin/env python3
# TODO: describe
# Copyright 2020 Tateru 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/licen... | StarcoderdataPython |
11392057 | from .virtual_gateway import VirtualGateway
| StarcoderdataPython |
3249986 | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import thinkplot
import thinkstats2
def read_statistics(year):
draws = pd.read_csv('./euromillions-past-draws-archive/euromillions-past-draws-archive' + str(year) +'.txt', skiprows=2, usecols=[1,2,3,4,5], sep = '\t', names=['1','2','3','4','5'])
... | StarcoderdataPython |
6410274 | <reponame>jjwatts/gigantum-client
# Copyright (c) 2017 FlashX, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, cop... | StarcoderdataPython |
6643228 | from pynput import keyboard
import RPi.GPIO as GPIO
import time
import cv2
def on_press(key):
try: k = key.char # single-char keys
except: k = key.name # other keys
if key == keyboard.Key.esc: return False # stop listener
GPIO.setmode(GPIO.BOARD)
GPIO.setup(32,GPIO.OUT)
GPIO.setup(31,GPIO.... | StarcoderdataPython |
5181877 | <reponame>qais-yousef/lisa
# Copyright 2015-2017 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
3433805 | aktivirao = _State(0)
weight = 8
def run():
if not State.goldenium_activated.val:
return False
x,y=coord('goldenium')
#r.goto(*coord('goldenium'))
if not pathfind(x-16,y+8,-1):
return False
r.absrot(-90)
napgold(2)
sleep(0.3)
pump(2,1)
# Implementirati stak umesto ovoga
r.speed(60)
r.forward(96)
... | StarcoderdataPython |
8149937 | import json
import pandas as pd
import degiroapi
from degiroapi.product import Product
from degiroapi.order import Order
from degiroapi.utils import pretty_json
with open('c:\git\degiro\config.json','r') as file:
data = json.load(file)
user = data['degiro_user']
password = data['<PASSWORD>']
degiro = deg... | StarcoderdataPython |
5029078 | # Copyright 2018-Present Shanghai Yitu Technology Co., Ltd.
# Licensed under the Apache License, Version 2.0 | StarcoderdataPython |
1826725 | <reponame>cjoakim/azure-datagen<filename>python/main.py
"""
Usage:
python main.py gen_customers <count>
python main.py gen_products <count>
python main.py gen_aus_online_txn 2021-02-25 2022-02-25 100 > data\online_txn.json
python main.py gen_aus_flybuy_txn 2021-02-25 2022-02-25 100 > data\flybuy_txn.json
Option... | StarcoderdataPython |
1944361 | <gh_stars>100-1000
#! /usr/bin/env python3
"""Downloads project source checkouts for integration as samples"""
from __future__ import absolute_import
from __future__ import print_function
import os, subprocess
SAMPLE_DIRECTORY = '.samples'
class BaseSource( object ):
def __init__( self, root, project=None, dirname... | StarcoderdataPython |
359356 | <reponame>ADGiuliano/DevAndCompForRecSys2016
"""
@author: <NAME>
@contact: <EMAIL>
@organization: University of Padua
"""
import cPickle as Pickle
from Functions import Check_File as cf
#File contenente la classe che si occupa del salvataggio dei vari dizionari nei file .pik
class Pickle_operator:
... | StarcoderdataPython |
8136204 | import sqlite3
def create_splits(symbol, date, from_factor, to_factor):
"""
returns INTEGER
- last id of row created
"""
conn = sqlite3.connect('robinhood.db')
command = "INSERT INTO splits\
(symbol, date, from_factor, to_factor)\
VALUES ('{}', '{}', '{}', '{}');".format(symbol, date, from_facto... | StarcoderdataPython |
3299963 | <reponame>rootless4real/cozmo-python-sdk<filename>src/cozmo/event.py
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://... | StarcoderdataPython |
9629559 | from aws_xray_sdk.core import xray_recorder
from moto import mock_kinesis
from resources.events import event_service
from test.util import create_event_stream
xray_recorder.begin_segment("Test")
def test_stream_name(event_streams_table):
stream_name = event_service()._stream_name("foo", "1", "green")
assert... | StarcoderdataPython |
11257059 | """
Contain Task to set a scheduler task for todofehrist application
================================================================
Task is responsible to send emails to systems users who have pending
tasks with due_datetime on that particular day. Task/Method will be
invoked at 12 AM everyday (U... | StarcoderdataPython |
1737119 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.gis.db import models
from django.contrib.gis.geos import GEOSGeometry
# Create your models here.
class firewalls(models.Model):
geom = models.MultiLineStringField(srid=3857)
type = models.IntegerF... | StarcoderdataPython |
3252198 | <gh_stars>0
special.jacobi(n, alpha, beta[, monic]) | StarcoderdataPython |
25749 | from campy.graphics.gwindow import GWindow
from campy.graphics.gobjects import GOval, GRect
from campy.gui.events.mouse import onmouseclicked
import random
WINDOW_WIDTH = 600
WINDOW_HEIGHT = 400
ZONE_WIDTH = 100
ZONE_HEIGHT = 100
BALL_RADIUS = 15
MAX_SPEED = 6
MIN_Y_SPEED = 2
class ZoneGraphics:
def __init__(se... | StarcoderdataPython |
1977 | <reponame>mstoelzle/raisimLib
import os
import numpy as np
import raisimpy as raisim
import math
import time
raisim.World.setLicenseFile(os.path.dirname(os.path.abspath(__file__)) + "/../../rsc/activation.raisim")
world = raisim.World()
ground = world.addGround()
world.setTimeStep(0.001)
world.setMaterialPairProp("st... | StarcoderdataPython |
3390971 |
import fboxlib
fboxlib.open()
ba = fboxlib.boxarray([[(0,0), (100,100)]])
la = fboxlib.layout(ba)
mf = fboxlib.multifab(la, nc=3, ng=0)
print "#"*80
print "# before regridding"
la.echo()
fab = mf.fab(1)
fab.array[...] = 1.0
fab.array[10:20,10:20] = 2.0
fab.array[50:60,50:60] = 2.0
def tag_boxes(mf... | StarcoderdataPython |
11272033 | # -*- coding: UTF-8 -*-
"""
Tushare数据接口封装
====================================================================
"""
import requests
import os
import time
from datetime import datetime
import pandas as pd
import tushare as ts
from tma import DATA_PATH
TS_PRO_API = "http://api.tushare.pro"
FILE_TOKEN = os.path.join(DA... | StarcoderdataPython |
170603 | """
Copyright (C) 2021 NVIDIA Corporation. All rights reserved.
Licensed under the NVIDIA Source Code License. See LICENSE at the main github page.
Authors: <NAME>, <NAME>, <NAME>, <NAME>
"""
import torch
from torch import nn
from torch.nn import functional as F
from simulator_model import layers
import functools
impo... | StarcoderdataPython |
9603744 | from .commands import plot_kraken
| StarcoderdataPython |
327025 | <gh_stars>1-10
# Copyright 2020 - 2021 MONAI Consortium
# 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 a... | StarcoderdataPython |
9775178 | <filename>src/models/architectures/tools/interp_utils.py
import torch
import torch.nn as nn
import numpy as np
from scipy.interpolate import interp1d
# from lib.utils.geometry import rotation_matrix_to_angle_axis, rot6d_to_rotmat
# from lib.models.smpl import SMPL, SMPL_MODEL_DIR, H36M_TO_J14, SMPL_MEAN_PARAMS
from .in... | StarcoderdataPython |
3290140 | class DataObject:
'''
This class represents the scraped data as a python object.
'''
def __init__(self, content, title, source, date):
'''
__init__ initializes the data object.
@param content will be the content of the scraped data.
@param title will be the title of the ... | StarcoderdataPython |
5069669 | # In order to compute the collision percentage,
# just uncomment from createRT.c the 2 printfs
# to the create_chain function. Then compile
# again, and run "./rt.out 5 > passes.csv".
# Finally run "python collision_detector.py".
words = set(open('passes.csv').read().split())
unique = len(words)
print "Unique ", u... | StarcoderdataPython |
6688392 | <filename>setup.py
from setuptools import setup, find_packages
setup(name='maprdb_python_client',
version='1.1.4',
description='MapR-DB Python Client',
url='https://github.com/mapr/maprdb-python-client/',
author='MapR, Inc.',
keywords='ojai python client mapr maprdb',
packages=find... | StarcoderdataPython |
280196 | <gh_stars>10-100
# Copyright 2021 Open Source Robotics Foundation, 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 ... | StarcoderdataPython |
189439 | <reponame>PatchyVideo/PatchyVideo
from .init import routes, init_funcs
import os
import sys
import time
import asyncio
import traceback
import PIL
import copy
from aiohttp import web
from aiohttp import ClientSession
from bson.json_util import dumps, loads
from init import rdb
from utils.jsontools import *
from uti... | StarcoderdataPython |
11291774 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
parse_duration,
unified_strdate,
)
from .subtitles import SubtitlesInfoExtractor
class NRKIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?... | StarcoderdataPython |
258349 | # 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"); you may not u... | StarcoderdataPython |
3355350 | import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
setup(
name='graphene_django_firebase_auth',
version='1.0.0',
author='<NAME>',
author_email='<EMAIL>',
description=(
"Authentication provider for graphene-django and Google Fi... | StarcoderdataPython |
12861076 |
def sumOf(s, offset):
sum = 0
n = len(s)
for i in range(0, len(s)):
if s[i] == s[(i + offset) % n]:
sum += int(s[i])
return sum
file = open("./input/input1.txt", "r")
for s in file:
s = s.strip()
print('Part 1: ', sumOf(s, 1))
print('Part 2: ', sumOf(s, int(len(s)/2)))
file.close() | StarcoderdataPython |
3401843 | #!/usr/bin/env python
'''
Selects a random word from words.txt.out
and scrambles the letters inside the word in various ways
'''
import logging
import random
import string
import sys
import os
import time
__author__ = "<NAME>"
__copyright__ = "Gytha Ogg"
__credits__ = ["Gytha Ogg"]
__license__ = "MIT"
__version__ = "... | StarcoderdataPython |
12819848 | # Generated by Django 3.2.6 on 2021-09-03 10:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("order", "0115_alter_order_language_code"),
("order", "0116_merge_20210824_1103"),
]
operations = []
| StarcoderdataPython |
1873526 | <filename>test/parser_2_segments_core_test.py<gh_stars>0
""" The Test file for The New Parser (Marker Classes)"""
import pytest
from sqlfluff.parser_2.markers import FilePositionMarker
from sqlfluff.parser_2.segments_base import RawSegment
from sqlfluff.parser_2.segments_core import KeywordSegment
@pytest.fixture(... | StarcoderdataPython |
11387407 | import copy
from datetime import datetime
from dateutil import parser
from contextlib import contextmanager
from memsql_loader.util import apsw_helpers, super_json as json
from memsql_loader.util.apsw_sql_step_queue.errors import TaskDoesNotExist, StepAlreadyStarted, StepNotStarted, StepAlreadyFinished, StepRunning, A... | StarcoderdataPython |
11341325 | """Support for deCONZ sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime
from pydeconz.sensor import (
AirQuality,
Consumption,
Daylight,
GenericStatus,
Humidity,
LightLevel,
Power,
Pressur... | StarcoderdataPython |
1895155 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
UNIVERSIDAD EL BOSQUE
PROYECTO INTEGRADO - TRANSFORMADAS / TRANSDUCTORES
Obtiene trozos de audio del microfono de forma recurrente
y grafica sus componentes en tiempo y frecuencia (FFT).
Detecta un tono puro en cualquier frecuencia audible,
reproduce el tono puro y ... | StarcoderdataPython |
6410497 | <filename>examples/enhancement.py
#!/usr/bin/env python
""" Explore image enhancement techniques """
from __future__ import division
import cv2
import numpy as np
import scipy.fftpack
from skimage import restoration
from examples import config
from selam.utils import img
from selam import colorconstancy as cc
from sel... | StarcoderdataPython |
4933688 | <filename>graphium/utilities/algorithm/routing_algorithm.py
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QGIS plugin 'Graphium'
/***************************************************************************
*
* Copyright 2020 <NAME> @ Salzburg Research
* eM... | StarcoderdataPython |
6422155 | <filename>tests/test_contacts/test_delete_contact.py
from model.contact import Contact
import random
def test_delete_some_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstname="Dara", middlename="Test", lastname="Bozhenko", username="dbozhenko",
... | StarcoderdataPython |
1648823 | # slope
"""
x_0:
initial position
dt:
dt float
iteration:
integer
a:
accerelation
0 < a < 1
t:
dt * iteration
"""
# class slope_field(object):
# """docstring for slope_field"""
# def __init__(self, arg):
# super(slope_field, self).__init__()
# self.arg = arg
def slope(x_0, dt, iteration, a):
... | StarcoderdataPython |
219079 | # Eingabe ist eine Liste mit Zahlen, es soll augegebenwerden, wie viele Zahlen
# größer als ihre Vorgänger sind
incr = 0
letzte = int(input())
while True:
eingabe = input()
if eingabe != '' and eingabe.isdigit():
zahl = int(eingabe)
if zahl > letzte:
incr += 1
letzte = zahl
... | StarcoderdataPython |
5012530 | # Generated by Django 2.0.3 on 2018-05-05 14:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hosts', '0002_auto_20180424_1114'),
]
operations = [
migrations.CreateModel(
name='Config',
fields=[
... | StarcoderdataPython |
11225049 | """
Setup module for the utilbox package.
"""
import setuptools
from utilbox import __conf__
def read_file(file_path):
with open(file_path, "r") as target_file:
return target_file.read()
# retrieve information from package files
package_version = __conf__.config_map["version"]
package_requirements =... | StarcoderdataPython |
4990989 | <reponame>marionumza/vocal_v12
# -*- coding: utf-8 -*-
{
"name": "Amazon Odoo Affiliate Integration",
'summary': """Amazon Odoo Affiliate Integration""",
"category": "Website",
"version": "1.0.0",
"author": "",
"license": "Other proprietary",
"maintainer": "",
"website": "",
"descrip... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.