id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1787707 | <gh_stars>0
from . import *
from .window import *
from .keycodes import *
from .keyboard import *
from .timer import *
from .output import *
from .ui import *
from .audio import *
| StarcoderdataPython |
3328180 | <filename>move_ur_action_server.py
#!/usr/bin/env python
# Copyright 2018 NoMagic Sp. z o.o.
#
# 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.... | StarcoderdataPython |
3473588 | # 作用域(scope)
# 作用域指的是变量生效的区域
b = 20 # 全局变量
def fn():
a = 10 # a定义在了函数内部,所以他的作用域就是函数内部,函数外部无法访问
print('函数内部:', 'a =', a)
print('函数内部:', 'b =', b)
# fn()
# print('函数外部:','a =',a)
# print('函数外部:','b =',b)
# 在Python中一共有两种作用域
# 全局作用域
# - 全局作用域在程序执行时创建,在程序执行结束时销毁
# - 所有函数以外的区域都是全... | StarcoderdataPython |
6604575 | <reponame>ryanstocks00/positron-cross-section
"""Module for calculating properties of gasses."""
from pathlib import Path
from typing import Any, TypeVar
import numpy as np
import pandas
from numpy.typing import NDArray
GAS_CONSTANT = 8.31446261815324
AVOGADROS_CONSTANT = 6.02214086e23
MTORR_TO_PASCALS = 0.13332237... | StarcoderdataPython |
310424 | <gh_stars>10-100
import matplotlib.pyplot as plt
from copylot import CoPylot
## Minimum working example -> Must update path to weather file
cp = CoPylot()
r = cp.data_create()
assert cp.data_set_string(
r,
"ambient.0.weather_file",
"../climate_files/USA CA Daggett (TMY2).csv",
)
assert cp.g... | StarcoderdataPython |
6675540 | # UDP demo
# works with ledcontrol.py
#
# <NAME>
# <EMAIL>
import RPi.GPIO as GPIO
import time,socket,traceback
pin = 17
IP = ''
PORT = 50006
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.bind((IP,PORT))
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin,GPIO.OUT)
GPIO.output(pin,GPIO.LOW)
print('Listening...')
... | StarcoderdataPython |
8014875 | #!/usr/bin/env python3
from ArgditLib.ProcLog import ProcLog
from Bio import SeqIO
from Bio.Seq import Seq
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument('seq_db_path', help = 'nucleotide/protein database FASTA file path')
parser.add_argument('replace_seq_file_path', help = 'FASTA f... | StarcoderdataPython |
9792139 | from PyObjCTools.TestSupport import *
import array
from CoreFoundation import *
import os
from Foundation import NSURL
try:
unicode
except NameError:
unicode = str
try:
long
except NameError:
long = int
class TestURL (TestCase):
def testTypes(self):
self.assertIs(CFURLRef, NSURL)
d... | StarcoderdataPython |
5112604 | import numpy as np
class CosineDistance:
def __call__(self, y: np.ndarray, y_pred: np.ndarray) -> np.float64:
return self.loss(y, y_pred)
def loss(self, y: np.ndarray, y_pred: np.ndarray) -> np.float64:
return np.dot(y, y_pred) / (np.linalg.norm(y) * np.linalg.norm(y_pred))
| StarcoderdataPython |
4891029 | <reponame>hase1128/dragonfly<filename>examples/synthetic/park1_3/park1_3_mf.py
"""
Park1 function with three domains.
-- <EMAIL>
"""
# pylint: disable=invalid-name
try:
from .park1_3 import park1_3_z_x
except ImportError:
from .park1_3 import park1_3_z_x
def park1_3_mf(z, x):
""" Computes the park1 functio... | StarcoderdataPython |
8148163 | <gh_stars>0
p = float(input('Me informe seu peso: '))
a = float(input('Me informe sua altura: '))
imc = p/(a**2)
print(f'SEU IMC {imc:.1f}')
if imc <= 18.50:
print('Você se encontra ABAIXO DO PESO')
elif imc > 18.51 and imc <= 25.00:
print('Você se encontra no PESO IDEAL')
elif imc > 25.01 and imc < 30.00:
... | StarcoderdataPython |
3266484 | """
Fixtures for testing
"""
import pytest
import seamm_datastore
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
@pytest.fixture()
def session():
some_engine = create_engine("sqlite:///:memory:")
# create a configured "Session" class
Session = sessionmaker(bind=some_engine... | StarcoderdataPython |
3228963 | <reponame>jmrozanec/features-generator
import os
# https://stackoverflow.com/questions/682504/what-is-a-clean-pythonic-way-to-have-multiple-constructors-in-python
class CreateKeyDataframeAction():
def __init__(self, key_name=None, columns=None):
self.key_name = None
self.columns = None
class Squa... | StarcoderdataPython |
3358092 | from inspect import getfile
from numbers import Number
from os.path import realpath
from pathlib import Path
from typing import Dict, Iterable, AnyStr, Sequence
from typing import Union
from ppb import Vector
from ppb.events import EventMixin
TOP = "top"
BOTTOM = "bottom"
LEFT = "left"
RIGHT = "right"
error_message... | StarcoderdataPython |
3548130 | <reponame>Tech-With-Tim/models
from typing import List
from pydantic import BaseModel
from functools import cached_property
from .permission import BasePermission
class BaseCategory(BaseModel):
"""
Base class for a permission category
Attributes:
:param str name: The name of the p... | StarcoderdataPython |
391843 | <gh_stars>1-10
__author__ = 'Orthocenter'
| StarcoderdataPython |
6533007 | from yalul.parser import Parser
from yalul.lex.token import Token
from yalul.lex.token_type import TokenType
from yalul.parsers.ast.nodes.statements.expressions.func_call import FuncCall
from yalul.parsers.ast.nodes.statements.expressions.variable import Variable
class TestFuncCallExpressions:
"""Test parser gene... | StarcoderdataPython |
3320068 | import testflows.settings as settings
from testflows.core import *
@TestStep(Given)
def instrument_clickhouse_server_log(self, node=None, test=None,
clickhouse_server_log="/var/log/clickhouse-server/clickhouse-server.log"):
"""Instrument clickhouse-server.log for the current test (default)
by adding st... | StarcoderdataPython |
9631221 | <filename>solutions/hydrothermal_venture.py<gh_stars>0
"""
Part One
========
Determine the number of points where at least two lines overlap. In the
above example, this is anywhere in the diagram with a 2 or larger - a
total of 5 points.
Consider only horizontal and vertical lines. At how many points do at
least two ... | StarcoderdataPython |
6505498 | students = []
scores_lst=[]
for _ in range(int(input())):
name = input()
score = float(input())
scores_lst.append(score)
students.append([name,score])
scores_unique = list(set(scores_lst))
y = sorted(scores_unique)[1]
temp = [i[0] for i in students if i[1]==y]
temp.sort()
print("\n".join(temp))
| StarcoderdataPython |
3402211 | # tileDEMs.py
# This script looks in the master shapefile for a series of polygons. It then looks for all the DEMs in the directory, finds which DEM
# the polygon is in, and then clips the raster to this polygon. It writes the raster to a tile sub-directory.
# FJC 30/06/21
#import osgeo.gdal as gdal
import pandas a... | StarcoderdataPython |
3500190 | <filename>Python/ReverseNumber.py
#https://leetcode.com/problems/reverse-integer/
#Given a 32-bit signed integer, reverse digits of an integer.
#Note:
#Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem, as... | StarcoderdataPython |
4902287 | class DurgaError(Exception):
"""Main exception class."""
pass
class ObjectNotFoundError(DurgaError):
"""The requested object does not exist."""
pass
class MultipleObjectsReturnedError(DurgaError):
"""The request returned multiple objects when only one was expected.
That is, if a GET request... | StarcoderdataPython |
3417083 | class Solution(object):
def maxWidthOfVerticalArea(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
points.sort(key=lambda x:x[0])
k=[]
for i in range (0, len(points)):
j=i+1
if j != len(points):
k.append... | StarcoderdataPython |
3214207 | from jetbot import ObjectDetector
from jetbot import Camera
import cv2
import numpy as np
model = ObjectDetector('ssd_mobilenet_v2_coco.engine')
camera = Camera.instance(width=300, height=300)
detections = model(camera.value)
while True:
# compute all detected objects
detections = model(c... | StarcoderdataPython |
9730057 | """
Loss Development
================
"""
import numpy as np
import copy
import warnings
from sklearn.base import BaseEstimator
from chainladder import WeightedRegression
class DevelopmentBase(BaseEstimator):
def fit_transform(self, X, y=None, sample_weight=None):
""" Equivalent to fit(X).transform(X)
... | StarcoderdataPython |
159089 | <reponame>Pistak/ha-smartthinq-sensors
import enum
from .device import STATE_OPTIONITEM_NONE
# Dryer State
class STATE_DRYER(enum.Enum):
POWER_OFF = STATE_OPTIONITEM_NONE
COOLING = "Cooling"
DRYING = "Drying"
END = "End"
ERROR = "Error"
ERRORSTATE = "An error occurred"
INITIAL = "Select C... | StarcoderdataPython |
9778759 | #!/usr/bin/env python3
"""
Licensed under Apache License 2.0
Original source:
https://github.com/lucidsoftware/apt-boto-s3
It was adapted to python3:
https://github.com/Kirill888/apt-boto-s3
This provides S3 transport for apt-get.
Installation
------------
```
install -m 755 ./s3.py /usr/lib/apt/methods/s3
a... | StarcoderdataPython |
5189651 | <filename>remindme/cli.py
'''
Command-line runner for Application
'''
import argparse
import sys
from . import config
from . import utils
from .Repository import Repository
def arg_parser():
'''Argument Parser.'''
parser = argparse.ArgumentParser(
description='Reminds you of something you knew before... | StarcoderdataPython |
4903400 | <reponame>aforalee/rallyALi
# Copyright 2014: Mirantis Inc.
# 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-... | StarcoderdataPython |
3265224 | import turtle
import math
print("导入a包")
__all__=["module_A","module_A2"] | StarcoderdataPython |
6516832 | import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(sys.argv[0]))), 'libs'))
from cpp import parser, tree
from optparse import OptionParser
import traceback
try:
import cPickle as pickle
except ImportError:
import pickle
option_decl = OptionParser()
... | StarcoderdataPython |
8064853 | from cassiopeia import riotapi
from cassiopeia.type.core.common import LoadPolicy
import csv
import urllib
import configparser
import mysql.connector
def main():
config = configparser.ConfigParser()
config.read('settings.ini')
riotapi.set_api_key(config.get('LoL API','key'))
riotapi.set_load_policy(Load... | StarcoderdataPython |
3210245 | """
Taken and adapted from https://github.com/graphdeeplearning/graphtransformer
"""
import torch.nn as nn
import dgl
from net.blocks import MLPReadout
from net.layer import GraphTransformerLayer
class GraphTransformerNet(nn.Module):
def __init__(self, net_params):
super().__init__()
num_atom_fe... | StarcoderdataPython |
9696004 | <reponame>alishaar/lyric_scraper
# -*- coding: utf-8 -*-
"""lyrics_scraper.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1FHuLFfoEoAVWb2I1v7stRVT7m86FemxL
"""
!pip install bs4
import requests
from bs4 import BeautifulSoup
import sys
import... | StarcoderdataPython |
3400640 | # -*- coding: utf-8 -*-
"""
OpenTabulate configuration file parser and class.
This reads '$HOME/.config/opentabulate.conf' using the ConfigParser class and
configures the OpenTabulate command line tool. It stores information such as where
the OpenTabulate root directory is, tabulation parameters (e.g. output encodin... | StarcoderdataPython |
5051498 | <filename>openwisp_users/api/permissions.py
from django.utils.translation import gettext_lazy as _
from rest_framework.permissions import BasePermission
from swapper import load_model
Organization = load_model('openwisp_users', 'Organization')
class BaseOrganizationPermission(BasePermission):
def has_object_perm... | StarcoderdataPython |
3238134 | #!/usr/bin/env python
"""
Torture-test Afterglow Core API
"""
import argparse
import base64
import json
import random
import requests
import time
import traceback
import warnings
from multiprocessing import Process
from typing import Any, Dict, Optional, Union
def api_call(host, port, https, root, api_version, toke... | StarcoderdataPython |
6508582 | from models.property import PropertyModel
import json
def test_get_properties(client, test_database):
"""the server should successfully retrieve all properties"""
response = client.get("/api/properties")
assert response.status_code == 200
def test_post_property(client, auth_headers, new_property):
pro... | StarcoderdataPython |
1991412 | <filename>set_up/group_settings.py
import discord
from discord.ext import commands
from set_up.settings import BotSettings, SettingTypes
from database.database import Database, SelectType
from tools.string import StringTools
import tools.channels as ChannelTools
import tools.error as Error
import tools.weather as Weath... | StarcoderdataPython |
6556319 | from mayan.apps.testing.tests.base import BaseTestCase
from ..events import event_cache_created, event_cache_purged
from ..models import Cache
from .mixins import CacheTestMixin
class CacheEventsTestCase(CacheTestMixin, BaseTestCase):
def test_cache_create_event(self):
self._clear_events()
... | StarcoderdataPython |
8143450 | #!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2010-2011 OpenStack, 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
#
# http://www.apache.org/lice... | StarcoderdataPython |
9680134 | <gh_stars>0
from typing import Union, Optional
__all__ = ("Surah", "Ayah", "Search", "ApiError", "ContentTypeError", "NumberError", "WrongLang")
class ApiError(Exception):
def __init__(self, status: int, msg: str) -> None:
super().__init__(f"Api has an error, return code: {status}.\n{msg}")
class Conten... | StarcoderdataPython |
3326410 | import argparse
import pathlib
import sys
from typing import List
from typing import Optional
import black
from lib3to6 import checker_base as cb
from lib3to6 import checkers
from lib3to6 import common
from lib3to6 import fixer_base as fb
from lib3to6 import fixers
from lib3to6 import transpile
BLACK_TARGET_VERSIONS... | StarcoderdataPython |
49230 | <gh_stars>1-10
from .heroku_client import HerokuClient
__version__ = "1.2.0"
__all__ = ["HerokuClient"]
| StarcoderdataPython |
11212010 | '''Version 0.32'''
import json
import csv
import glob
import sys
import importlib
from pprint import pprint
from collections import Counter
# init is an optional flag to indicate you're starting
# over; old autograder results are written over and column
# headers are printed to the file.
team = "0"
init = False
for ar... | StarcoderdataPython |
6600013 | import os
import time
import yaml
import datetime
import linecache
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pymatgen import MPRester
from pymatgen.io.cif import CifWriter
from diffpy.Structure import loadStructure
from diffpy.srreal.structureadapter import nosymmetry
from diffpy.srre... | StarcoderdataPython |
88720 | <reponame>otovo/python-sanity-html<gh_stars>10-100
from __future__ import annotations
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, cast
from portabletext_html.utils import get_default_marker_definitions
if TYPE_CHECKING:
from typing import Literal, Optional, Tuple, Type, Union
... | StarcoderdataPython |
8005477 | <gh_stars>10-100
__author__ = 'shukkkur'
'''
https://codeforces.com/problemset/problem/148/A
'''
k = int(input())
l = int(input())
m = int(input())
n = int(input())
d = int(input())
healthy = 0
for i in range(1, d + 1):
if i % k != 0 and i % l != 0 and i % m != 0 and i % n != 0:
... | StarcoderdataPython |
100745 | import json
import logging
import shutil
import requests
from spreads.vendor.pathlib import Path
from spreadsplug.web import task_queue
from util import find_stick, mount_stick
from persistence import get_workflow, save_workflow
logger = logging.getLogger('spreadsplug.web.tasks')
@task_queue.task()
def transfer_to... | StarcoderdataPython |
1900624 | #
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
# Copyright (c) 2018 <NAME> - All Rights Reserved.
#
import os
import sqlite3
from salty_orm.db.base_provider import BaseDBConnection, NotConnectedError, ConnectionFailedError, \
Exec... | StarcoderdataPython |
8012505 | <filename>src/utils.py
import logging
import os
import re
import sqlite3
import subprocess
import time
import uuid
import ppadb.client
import ppadb.command.serial
import ppadb.device
REGEX_USER: re.Pattern = re.compile(r"UserInfo\{([0-9]*):([a-zA-Z ]*):.*")
REGEX_FOCUS: re.Pattern = re.compile(r"mCurrentFocus.*com.Ps... | StarcoderdataPython |
9735509 | <filename>app.py
import os
from flask import Flask
from twilio import twiml
import requests
# Declare and configure application
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('local_settings.py')
app.config['API_PATH'] = \
"http://api.nytimes.com/svc/mostpopular/v2/"\
"mostviewed/a... | StarcoderdataPython |
5123902 | <filename>sdk/python/pulumi_google_native/artifactregistry/v1beta2/get_repository.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing im... | StarcoderdataPython |
6440491 | <gh_stars>10-100
from .viewer import *
from PySide2.QtWidgets import QSizePolicy, QVBoxLayout, QTextEdit
from PySide2.QtGui import QFont
class DataViewerRaw(DataViewer):
def __init__(self):
DataViewer.__init__(self)
self.text_box = QTextEdit()
self.text_box.setReadOnly(True)
font ... | StarcoderdataPython |
5015863 | <filename>proto_matcher/matcher/matcher.py
from typing import Optional, Set, Tuple, Union
from google.protobuf import message
from google.protobuf import text_format
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.description import Description
from hamcrest.core.helpers.wrap_matcher import wrap_... | StarcoderdataPython |
1740622 | <gh_stars>0
# Create a SQL alchemy session maker to be used
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
SQLALCHEMY_DATABASE_URL = "postgresql+psycopg2://admin:admin@localhost/pht_conductor"
engine = create_engine(
SQLALCHEMY_DATABASE_URL, # connect_args={"check_same_thread": Fals... | StarcoderdataPython |
5199468 | from typing import Union
import h5py
class SdsDatasets:
def __init__(self, h5_obj: Union[str, h5py.File]):
"""
Class to handle data loading from GEDI h5 datasets
:param h5_obj: Path of h5 file or h5 file loaded using h5py.File
"""
if isinstance(h5_obj, str):
... | StarcoderdataPython |
8100283 | <filename>fatd/holders/transitions.py
import numpy as np
import fatd.transform.tools.training
import fatd.holders
# From data to model
class Data2Model(object):
def __init__(self, splitting_function=None):
self.training_indices = None
self.test_indices = None
if splitting_function is Non... | StarcoderdataPython |
3374364 | <gh_stars>1-10
import os
import time
import getpass
username = getpass.getuser()
def find():
os.system("cd /")
os.system("cd /home")
os.system("cd "%s) % username
def kill():
writepath = start.py
mode = 'a'
file_path = 'cat.txt'
try:
fp = open(cat.txt)
except IOError:
# If not exists, create th... | StarcoderdataPython |
1734932 | <reponame>eldad-a/BioCRNPyler
from biocrnpyler.chemical_reaction_network import Species, Reaction, ComplexSpecies, ChemicalReactionNetwork
print("Start")
#Names of different supported propensities
propensity_types = ['hillpositive', 'proportionalhillpositive', 'hillnegative', 'proportionalhillnegative', 'massaction',... | StarcoderdataPython |
3223591 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-05-03 19:56
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | StarcoderdataPython |
5122760 | # Code to distill the knowledge from a Teacher to Student using data generated by a Generator
from __future__ import print_function
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.data... | StarcoderdataPython |
12851962 | # Generated by Django 4.0.1 on 2022-01-10 09:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('firstApp', '0005_alter_registration_firstname'),
]
operations = [
migrations.AlterField(
model_name='registration',
... | StarcoderdataPython |
6538023 | <gh_stars>1-10
from unittest import TestCase
import numpy as np
import pandas as pd
from pybleau.app.plotting.api import factory_from_config
from pybleau.app.plotting.bar_factory import BarPlotFactory
from pybleau.app.plotting.heatmap_factory import HeatmapPlotFactory
from pybleau.app.plotting.histogram_factory impor... | StarcoderdataPython |
9686745 | <reponame>74gigi8/Learning-Path-Learn-Web-Development-with-Python<gh_stars>10-100
from rest_framework import serializers
from posts import models
class PostSerializer(serializers.ModelSerializer):
posted_by = serializers.SerializerMethodField()
def get_posted_by(self, obj):
return obj.posted_by.usern... | StarcoderdataPython |
296579 | import sublime_plugin
import sublime
# 20171211 - read in states via settings file - also use settings to define which states
# are considered to be active - so that only those states are displayed for "All Active"
# 20171106 - added in capability to choose all (including done) and all-active (not done).
# See corre... | StarcoderdataPython |
3593851 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by <NAME> and <NAME>
# published by PACKT Publishing
#
# It is made available under the MIT License
from __future__ import print_function
import logging
import gensim
import numpy as np
# Set up logging in order to get p... | StarcoderdataPython |
6647146 | import matplotlib.pyplot as plt
from networkx import Graph, draw_networkx_nodes, draw_networkx_edges, \
draw_networkx_labels, spring_layout
from similarity import group_similarity
def author_graph(authorSubs):
authors = list(authorSubs.keys())
G = Graph()
n = len(authors)
for i in range(n):
... | StarcoderdataPython |
11231576 | <reponame>ryanohoro/natlas
from flask import redirect, url_for, flash, render_template, request, current_app, session
from flask_login import login_user, logout_user, current_user
from app import db
from app.auth.forms import LoginForm, RegistrationForm, ResetPasswordRequestForm, \
ResetPasswordForm, InviteConfirmForm... | StarcoderdataPython |
1983311 | """Coordinates calculations.
This package is in early development stage nad can be deeply changed or even excluded
Actually allows image/WCS coordinates calculation using external xt2sky/sky2xy
tools from WCS tools. (which supports sextractor fits header format for distortion)
and matching multiple catalogs at once.
... | StarcoderdataPython |
256692 | <reponame>cristianCarrerasCastillo/django_cafeteria
from django.shortcuts import get_object_or_404, render
from .models import Page
# Create your views here.
def page(request, page_id):
page = get_object_or_404(Page, id=page_id)
return render(request, 'pages/sample.html', {'page': page})
| StarcoderdataPython |
4959022 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-07-03 17:43
from __future__ import unicode_literals
from django.db import migrations
import waldur_core.core.fields
class Migration(migrations.Migration):
dependencies = [
('waldur_jira', '0018_project_runtime_state'),
]
... | StarcoderdataPython |
12827797 | from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from electrum_ltc.i18n import _
Builder.load_string('''
#:import _ electrum_ltc_gui.kivy.i18n._
<CheckpointDialog@Popup>
id: popup
title: _('Blockchain')
size_hint: 1, 1
... | StarcoderdataPython |
87882 | <reponame>kemusiro/microc-compiler<filename>llvmgen.py
from util import *
# 項に対するLLM表現を返す。
def llvm_id(func, value):
if func.symtable.get_sym(value) is not None:
return func.symtable.get_sym(value, 'llvm_name')
elif func.program.symtable.get_sym(value) is not None:
return func.program.symtable.... | StarcoderdataPython |
149932 | # -*- coding: utf-8 -*-
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from .popup import PopUp
class Mechanic:
def __init__(self, conndb):
self.conn = conndb
mechanik_builder = Gtk.Builder()
mechanik_builder.add_from_file("glade/mechanic.glade")
self.... | StarcoderdataPython |
5011775 | from Urutu import *
import numpy as np
@Urutu("CU")
def add(e,f,d,a,b,c):
c[tx] = a[tx] + b[tx]
d[tx] = a[tx] - b[tx]
e[tx] = a[tx] * b[tx]
f[tx] = a[tx] + b[tx]
return c,d,e,f
a = np.random.randint(10,size=100)
b = np.random.randint(10,size=100)
c = np.empty_like(b)
d = np.empty_like(b)
e = np.empty_like(b)
f =... | StarcoderdataPython |
3479354 | """google_calendar_helpers
Simple helpers to deal with Google calendar, and the replies it sends.
"""
from datetime import datetime
from typing import Any, Dict, List, Union
from dateutil import parser
from ..classes.calendar_event_class import CalendarEvent
def convert_events(
events: List[CalendarEvent], for... | StarcoderdataPython |
9761603 | """Configuration of PMF with PSIS-LOO for BO optimization."""
import pmf_objectives as model
import numpy as np
import time
import logging
logger = logging.getLogger(__name__)
# BO cofiguration
n_init = 2
num_iterations = n_init + 1000
lower = np.array([1, -4,-4,-4,-4])
upper = np.array([100, 2,2,2,2])
X_init = No... | StarcoderdataPython |
6450192 | <filename>construct_dict.py
import os
import torch
import torch.nn.functional as F
from torchvision import datasets, transforms
from torch.autograd import Variable
import torch.nn as nn
import load_activations as la
import hierarhical_tree_gpu as ht
from load_data import get_data
# from train_utils import train, tes... | StarcoderdataPython |
8188404 | import os
import numpy as np
from random import shuffle
from collections import namedtuple
from glob import glob
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from tf2_module import build_generator, build_discriminator_classifier, softmax_criterion
from tf2_utils import get_now_datetime, save_mi... | StarcoderdataPython |
4908324 | <reponame>dh-ab93/OSS-SAKI<filename>4-deep-q-learning/traders/trusting_trader.py
from typing import List
from framework.company import Company
from framework.interface_expert import IExpert
from framework.interface_trader import ITrader
from framework.logger import logger
from framework.portfolio import Portfolio
from... | StarcoderdataPython |
1611647 | <filename>alipay/aop/api/domain/GFAOpenAPIAccountingAcceptance.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class GFAOpenAPIAccountingAcceptance(object):
def __init__(self):
self._amount_map = None
self._biz_bill_nos_map = None... | StarcoderdataPython |
5072243 | import math
def point_distance(point1, point2):
"""
Returns the distance between two points given as tuples
"""
distance = math.sqrt(((point1[0] - point2[0])**2) +
((point1[1] - point2[1])**2))
return distance
def multidimensional_distance(point1, point2):
"""
Re... | StarcoderdataPython |
5069680 | import pytest
import numpy as np
import scipy.stats
from maxent_graph.poibin import dc_pb1, dc_pb2, dc_fft_pb
def test_dc_pb():
# todo: handle empty list case
for n in [10, 100, 1000, 10_000]:
ps = np.random.rand(n)
# both DC methods should give same results
r1 = dc_pb1(ps)
r... | StarcoderdataPython |
1938753 | """
PyXLL Examples: Automation
PyXLL worksheet and menu functions can call back into Excel
using the Excel COM API*.
In addition to the COM API there are a few Excel functions
exposed via PyXLL that allow you to query information about
the current state of Excel without using COM.
Excel uses different security polic... | StarcoderdataPython |
190245 | <reponame>Raahul-Singh/pythia
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pytest
from astropy.io import fits
from pythia.learning.datasets import BaseDataset
from pythia.learning.transforms import *
from torchvision import transforms
PATH = Path(__file__).par... | StarcoderdataPython |
3515410 | import os
import time
import asyncio
import redis
import pandas as pd
from bs4 import BeautifulSoup
from multiprocessing import Pool
PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + "/dataset"
URI = "http://finance.naver.com/item/sise_day.nhn?code={}&page={}"
r = redis.StrictRedis(host='lo... | StarcoderdataPython |
348441 | import boto3
import pendulum
from bloop import UUID, BaseModel, Column, Engine
from bloop.ext.pendulum import DateTime
def engine_for_region(region, table_name_template="{table_name}"):
dynamodb = boto3.client("dynamodb", region_name=region)
dynamodbstreams = boto3.client("dynamodbstreams", region_name=regio... | StarcoderdataPython |
1873392 | import PikaStdLib
import W801Device
pb5=W801Device.GPIO()
pb25=W801Device.GPIO()
time=W801Device.Time()
pwm = W801Device.PWM()
pb5.init()
pb5.setPin('PB5')
pb5.setMode('out')
pb5.setPull('up')
pb5.enable()
pb25.init()
pb25.setPin('PB25')
pb25.setMode('out')
pb25.setPull('up')
pb25.enable()
##pwm.init()
pwm.setPin('... | StarcoderdataPython |
3302383 | #!/usr/bin/python3
#Code written by
# _ _ __
# ___ | |_ _ __ / | / _| ___
# / __|| __|| '__|| || |_ / _ \
# \__ \| |_ | | | || _|| __/
# |___/ \__||_| |_||_| \___|
#
# Простая реализациия элементарных клеточных автоматов с применением ООП.
# Использование: создаете экземлпяр класса Wolfr... | StarcoderdataPython |
1821389 | <filename>survol/sources_types/mysql/table/__init__.py
"""
MySql table
"""
import lib_common
from sources_types import mysql as survol_mysql
from sources_types.mysql import instance as survol_mysql_instance
from sources_types.mysql import database as survol_mysql_database
def EntityOntology():
return ( ["Instance","... | StarcoderdataPython |
9749679 | <reponame>tranconbv/ironpython-stubs
# encoding: utf-8
# module Wms.RemotingImplementation.Scripting.Remoting calls itself Remoting
# from Wms.RemotingImplementation,Version=1.23.1.0,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no important
from __init__ import *
# no functions
# classe... | StarcoderdataPython |
1682599 | <gh_stars>0
PLUGINS = dict()
def register(func):
PLUGINS[func.__name__] = func
return func
@register
def add(a, b):
return a + b
@register
def multiply(a, b):
return a * b
def operation(func_name, a, b):
func = PLUGINS[func_name]
return func(a, b)
print(PLUGINS)
print(operation('add', 2... | StarcoderdataPython |
11353101 | for i in '7891561899':
print(i)
print(len('djakaoo'))
print(len("ddddddd"))
| StarcoderdataPython |
126373 | __all__ = ["mi_enb_decoder"]
PACKET_TYPE = {
"0xB0A3": "LTE_PDCP_DL_Cipher_Data_PDU",
"0xB0B3": "LTE_PDCP_UL_Cipher_Data_PDU",
"0xB173": "LTE_PHY_PDSCH_Stat_Indication",
"0xB063": "LTE_MAC_DL_Transport_Block",
"0xB064": "LTE_MAC_UL_Transport_Block",
"0xB092": "LTE_RLC_UL_AM_All_PDU",
"0xB082": "LTE_RLC_D... | StarcoderdataPython |
8088441 | #!/usr/bin/env python
import sys
import io
def print_help():
# print help message
print >> sys.stderr, "Usage: csv_conv.py [Options] <filename>"
print >> sys.stderr, "Options and arguments:"
print >> sys.stderr, " [-h/--help]: Show this message."
print >> sys.stderr, " [-s]: Define sperator. Defa... | StarcoderdataPython |
6683821 | <reponame>zaind6/Word-Search-Puzzle
# Code for working with word search puzzles
#
# Do not modify the existing code
#
# Complete the tasks below marked by *task*
#
# Before submission, you must complete the following header:
#
# I hear-by decree that all work contained in this file is solely my own
# and that I receive... | StarcoderdataPython |
321850 | <filename>mll/tests/test_receiver_fc.py
import torch
import numpy as np
from mll.recv_models import fc1l_model, fc2l_model
def test_fc1l():
N = 5
utt_len = 20
vocab_size = 4
embedding_size = 11
num_meaning_types = 5
meanings_per_type = 10
inputs = torch.from_numpy(np.random.choice(vocab_... | StarcoderdataPython |
9752572 | # -*- coding: utf-8 -*-
#
# Copyright 2019 Klimaat
import os
import time
import calendar
import numpy as np
import netrc
import shutil
import requests
import tarfile
from email.utils import parsedate_tz, mktime_tz
from rnlyss.dataset import Dataset
from rnlyss.grid import GaussianGrid
from rnlyss.util import syslog_e... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.