id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
4834632 | <filename>api/core/react-native/LibLedgerCore/binding_copy.gyp
{
'variables': {
'core_library%': "../../../../../lib-ledger-core-build",
'run_path%': "../../../../../lib-ledger-core-build/core/src/Release-iphonesimulator",
'header_path%': "../../objc",
},
'targets': [
{
'target_name': 'libledger-core-objc... | StarcoderdataPython |
3311151 | <reponame>Matthew1906/100DaysOfPython
# Import Modules
from flask import Flask, render_template, redirect, url_for, request, flash
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, FloatField
from wtforms.validator... | StarcoderdataPython |
3250211 | import timeit
import os
from objects import *
from serializers import *
from table import Table
class Evaluator:
OBJECTS_TO_EVALUATE = (
PrimitiveObject(int1=9, float1=3.1415, int2=-5156, float2=1e128), # Light object
DictObject(dict1={"D" + str(i): i ** 2 for i in range(100)}, # Medium object
... | StarcoderdataPython |
3236748 | <reponame>TorgeirUstad/dlite
#!/usr/bin/env python
from pathlib import Path
import dlite
print('dlite storage paths:')
for path in dlite.storage_path:
print('- ' + path)
print()
print('append path with glob pattern:')
thisdir = Path(__file__).parent.absolute()
dlite.storage_path.append(f'{thisdir}/*.json')
for... | StarcoderdataPython |
133301 | <gh_stars>10-100
from .tableview_blueprint import tableview_blueprint
from .get_tableview import get_tableview as __get_tableview
from .post_tableview import post_tableview as __post_tableview
from .delete_tableview import delete_tableview as __delete_tableview
from .put_tableview import put_tableview as __put_tablevie... | StarcoderdataPython |
3303632 | <gh_stars>0
'''
Thevenin Equivalent-Circuit Model
given values of R1 and C1, the code is going to iterate to predict, in a discrete time,
the state of charge (z), the difussion-resistor current (ir1) and the output voltage (v)
EQUATIONS OF THE MODEL (Now using number 1 and 3):
1) z(i+1) = z(i) - ((t2 - t1)) * n * I(i)... | StarcoderdataPython |
11618 | # -*- Python -*-
# license
# license.
# ======================================================================
"""Looks name up in the [geonames database](http://www.geonames.org/).
[GeoNames Search Webservice API](http://www.geonames.org/export/geonames-search.html)
"""
import sys, os, urllib.request, json, time
fro... | StarcoderdataPython |
3399931 | <filename>infermedica_api/webservice.py
# -*- coding: utf-8 -*-
"""
infermedica_api.webservice
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains function responsible for manging a global handlers for API Connector classes.
"""
from inspect import isclass
from typing import Optional, Any, Union
from . import exceptions... | StarcoderdataPython |
1615227 | from distutils.core import setup
setup(
name='sortedcounter',
version='0.1',
packages=['sortedcounter'],
license='MIT',
author='<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/ckingdev/sortedcounter',
download_url = 'https://github.com/ckingdev/sortedcounter/archive/0.1.ta... | StarcoderdataPython |
79795 | import pytest
from graphene import Field, ID, Int, ObjectType, String
from .. import graphql_compatibility
from ..extend import extend, external, requires
from ..main import build_schema
PRODUCT_SCHEMA_2 = """schema {
query: Query
}
type Product {
sku: ID
size: Int
weight: Int
shippingEstimate: String
}
... | StarcoderdataPython |
3296993 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from collections import deque
class Solution:
def findBottomLeftValue(self, root: TreeNode) -> int:
q = deque([roo... | StarcoderdataPython |
1664755 | <reponame>yunionyun/python_yunionsdk<gh_stars>1-10
from yunionclient.common import base
class Unifiedmonitor(base.ResourceBase):
pass
class UnifiedmonitorManager(base.StandaloneManager):
resource_class = Unifiedmonitor
keyword = 'unifiedmonitor'
keyword_plural = 'unifiedmonitors'
_columns = ["Id"... | StarcoderdataPython |
1637470 | import emacspy, socket, tempfile, queue, threading
from emacspy import sym
from typing import Optional
import concurrent.futures, traceback
_call_soon_queue: queue.Queue = queue.Queue(0)
_wakeup_conn: Optional[socket.socket] = None
_emacs_thread = threading.current_thread()
def call_soon_in_main_thread(f):
_call... | StarcoderdataPython |
54960 | # License: MIT
'''
:author: <NAME> (<EMAIL>)
:organization: ETS
'''
import ctypes as c
import logging
import os
class Tagger(object):
"""The ZPar English POS Tagger"""
def __init__(self, modelpath, libptr, zpar_session_obj):
super(Tagger, self).__init__()
# save the zpar session object
... | StarcoderdataPython |
3398647 | <filename>exceptions/exceptions.py
class RSAEcryptionException(Exception):
pass
class NotAnIterableObject(RSAEcryptionException):
pass
class NotATextMensage(RSAEcryptionException):
pass
class CastError(RSAEcryptionException):
pass
class NotAKey(RSAEcryptionException):
pass
class LoadKeyDictErro... | StarcoderdataPython |
1728517 | <reponame>kennethwdk/PINet
import torch
from torch import nn
from .utils import int_sample, float_sample
from .gcn_module import BasicGraphBlock, ResGraphBlock
from dataset import VIS_CONFIG
def build_pr_net(cfg, num_joints, input_channels=480):
net = PoseRefine(cfg, num_joints, input_channels)
return net
c... | StarcoderdataPython |
1658624 | <filename>torch_glow/tests/nodes/bmm_test.py
from __future__ import absolute_import, division, print_function, unicode_literals
import torch
from tests.utils import jitVsGlow
def test_bmm():
"""Basic test of the PyTorch bmm Node on Glow."""
def test_f(a, b):
return (a + a).bmm(b)
x = torch.ran... | StarcoderdataPython |
1727106 | <gh_stars>0
import contextlib
import errno
import os
import signal
import socket
import struct
def builtin_base(exc_type):
for cls in exc_type.mro():
if cls.__module__ != 'py3oserror':
return cls
# pytest.raises isn't catching these errors on Python 2.6
# implement a simple version with stan... | StarcoderdataPython |
3371870 | from typing import Optional, Sequence, Tuple, Union
import numpy as np
import pandas as pd
from sgkit.typing import ArrayLike
def _tuple_len(t: Union[int, Tuple[int, ...], str, Tuple[str, ...]]) -> int:
"""Return the length of a tuple, or 1 for an int or string value."""
if isinstance(t, int) or isinstance(... | StarcoderdataPython |
1668865 | <gh_stars>1-10
__version__ = "0.3.19"
| StarcoderdataPython |
18459 | <filename>tools/com/test/test_alpha.py
from tools.com.alpha import Flow, Path
def test_flow():
p = Path("TEST", "layer", ["TASK", "SUB"])
f = Flow(content="abc123", path=p, format="text", a=1, b=7, c="aaaa")
s = str(p).encode() + b"""
text
a: 1
b: 7
c: aaaa
abc123"""
assert f.to_byte... | StarcoderdataPython |
3309568 | import time, array, random, copy, math
import pandas as pd
import numpy as np
from math import sqrt
from deap import algorithms, base, creator, gp, benchmarks, tools
from deap.benchmarks.tools import diversity, convergence, hypervolume
from deap.tools import History
import json, codecs
import csv
from functions import... | StarcoderdataPython |
9412 | <reponame>xwu20/wmg_agent<filename>specs/test_gru_on_flat_babyai.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
### CONTROLS (non-tunable) ###
# general
TYPE_OF_RUN = test_episodes # train, test, test_episodes, render
NUM_EPISODES_TO_TEST = 1000
MIN_FINAL_REWARD_FOR_SUCCESS = 1.0
LOAD... | StarcoderdataPython |
1606833 | """
`edit-flags` command test module
"""
import pytest
from tests.utils import (
ARCH,
GefUnitTestGeneric,
gdb_start_silent_cmd_last_line,
gdb_start_silent_cmd,
)
@pytest.mark.skipif(ARCH not in ["i686", "x86_64", "armv7l", "aarch64"],
reason=f"Skipped for {ARCH}")
class EditFla... | StarcoderdataPython |
66050 | <reponame>GlobalFishingWatch/anchorages_pipeline
from __future__ import absolute_import
from apache_beam.options.pipeline_options import PipelineOptions
class PortEventsOptions(PipelineOptions):
@classmethod
def _add_argparse_args(cls, parser):
# Use add_value_provider_argument for arguments to be temp... | StarcoderdataPython |
36090 | # Copyright 2022 Tiernan8r
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | StarcoderdataPython |
3233646 | from datetime import datetime
import logging
from typing import List
import time
import hashlib
from scrapydd.models import session_scope, ProjectPackage, Project, Spider, \
Trigger, SpiderExecutionQueue, \
SpiderParameter, Session, User
from scrapydd.storage import ProjectStorage
from scrapydd.excepti... | StarcoderdataPython |
1627239 | # 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 import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | StarcoderdataPython |
1768763 | <reponame>sandbox-data-catalog/hiroshima-opendata-catalog<filename>ckanext-hiroshima/ckanext/hiroshima/lib/mailer.py
import ckan.plugins.toolkit as toolkit
import ckan.lib.mailer as mailer
from ckan.common import config
def send_confirm_mail_address(user_name, email, token):
host = config['ckan.host']
mail_ext... | StarcoderdataPython |
199977 | <gh_stars>1-10
import os
from conan.tools.files import rename
from conan.tools.microsoft import msvc_runtime_flag
from conans import CMake, ConanFile, tools
from conans.errors import ConanInvalidConfiguration
required_conan_version = ">=1.43.0"
class AwsSdkCppConan(ConanFile):
name = "aws-sdk-cpp"
license =... | StarcoderdataPython |
1726325 | from copy import deepcopy
from mesh.generic.nodeState import LinkStatus
def findShortestPaths(numNodes, meshGraph, startNode):
## Find shortest path to all other nodes using Dijkstra's algorithm
# Initialize arrays
pathArray = [[i+1,100,[-1]] for i in range(numNodes)]
#visited = [startNode... | StarcoderdataPython |
65138 | <gh_stars>10-100
#!/usr/bin/env python2
##########################################################
#
# Script: txt2float.py
#
# Description: Convert GMT text grid files into float
#
##########################################################
# Basic modules
import os
import sys
import struct
from ParseHeader import *
... | StarcoderdataPython |
3353620 | <reponame>manakpandey/reacmchain<filename>api/ml/getDemand.py
def current_day():
from datetime import datetime
datetime_object = datetime.now()
day1 = datetime_object.day
day = int(day1)
month1 = datetime_object.month
month = int(month1)
monthvalue = 0
if month == 1:
monthvalue ... | StarcoderdataPython |
16980 | <filename>pygama/dsp/_processors/trap_filter.py
import numpy as np
from numba import guvectorize
@guvectorize(["void(float32[:], int32, int32, float32[:])",
"void(float64[:], int32, int32, float64[:])",
"void(int32[:], int32, int32, int32[:])",
"void(int64[:], int32, int32, i... | StarcoderdataPython |
1708390 | """
Setup Module to setup Python Handlers for LSST query templating
"""
import setuptools
setuptools.setup(
name='jupyterlab_lsstquery',
version='1.0.0-alpha6',
packages=setuptools.find_packages(),
install_requires=[
'notebook',
],
package_data={'jupyterlab_lsstquery': ['*']},
)
| StarcoderdataPython |
62994 | <reponame>banxi1988/iOSCodeGenerator
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ios_code_generator.generators import as_ios_swift_generator
from ios_code_generator.maps import settings_raw_type_map
from ios_code_generator.models import Model, Field
from ios_code_generator.models import model_... | StarcoderdataPython |
3242300 | <gh_stars>100-1000
import flask
def success(data={}, status_code=200):
"""
Factory method for creating a successful Flask response.
:param data: JSON data to package with the response.
:param status_code: Optional HTTP status code.
:return: A tuple of (response object, status code) with the input... | StarcoderdataPython |
69017 | from rest_framework.test import APIClient
from tests.app.serializers import QuoteSerializer
from tests.utils import decode_content
def test_list_response_unfiltered():
response = APIClient().get('/quotes/')
expected = [
{
'character': 'Customer',
'line': "It's certainly uncont... | StarcoderdataPython |
99924 | def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the message... | StarcoderdataPython |
1763811 | from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.popup import Popup
from kivy.uix.label import Label
import matplotlib.pyplot as plt
import pandas as pd
from multiprocessing import Process
class ... | StarcoderdataPython |
1752496 | from django.db import models
# Create your models here.
class image_upload(models.Model):
name = models.CharField(max_length=50)
img = models.ImageField(upload_to='images/')
| StarcoderdataPython |
9646 | <reponame>michalgagat/plugins_oauth
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps(omit_commons_codec = True):
JACKSON_VERS = "2.10.2"
maven_jar(
name = "scribejava-core",
artifact = "com.github.scribejava:scribejava-core:6.9.0",
sha1 = "ed761f450d8382f75787e8fe... | StarcoderdataPython |
9308 | <gh_stars>1-10
import datetime
import os
import sys
import unittest
from unittest import mock
import akismet
class AkismetTests(unittest.TestCase):
api_key = os.getenv("TEST_AKISMET_API_KEY")
blog_url = os.getenv("TEST_AKISMET_BLOG_URL")
api_key_env_var = "PYTHON_AKISMET_API_KEY"
blog_url_env_var = ... | StarcoderdataPython |
1711149 | from useless.stack import Stack
from useless.globals import * | StarcoderdataPython |
3271159 | from django.db import models
class Watch(models.Model):
GENDER_CHOICES = (
('male', 'Male'),
('female', 'Female'),
('teenagers', 'Teenagers'),
('children', 'Children'),
('unisex', 'Unisex'),
)
brand = models.CharField(max_length=20, blank=False, null=False)
mod... | StarcoderdataPython |
116034 | # -*- coding: utf-8 -*-
#@Author: <NAME>
#@Date: 2019-11-18 20:53:24
#@Last Modified by: <NAME>
#@Last Modified time: 2019-11-18 21:44:1
import numpy as np
import torch
import torch.nn.functional as F
import os
def compute_pairwise_distance(x):
''' computation of pairwise distance matrix
---- Inp... | StarcoderdataPython |
3220574 | <reponame>tehmaze/piece
#!/usr/bin/env python2
import os
import sys
def convert(filename, stream=sys.stdout):
fontname = os.path.splitext(os.path.basename(filename))[0]
fontname = fontname.replace('-', '_')
glyphs = []
comments = []
h = 16
w = 8
with open(filename) as handle:
fo... | StarcoderdataPython |
87631 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
from functools import reduce
import operator
from seedot.compiler.antlr.seedotParser import seedotParser as SeeDotParser
import seedot.compiler.ast.ast as AST
from seedot.compiler.ast.astVisitor import ASTVisitor
class Ty... | StarcoderdataPython |
3252033 | <filename>bot/cogs/comics.py
import io
import random
import aiohttp
from bs4 import BeautifulSoup
from discord import Color, Embed, File
from discord.ext.commands import Cog, Context, command
from bot import config
from bot.core.bot import Bot
class Comics(Cog):
"""View random comics from popular sources."""
... | StarcoderdataPython |
3235158 | from rest_framework.serializers import ModelSerializer
from base.models import GrassMachine
class GrassMachineSerializer(ModelSerializer):
class Meta:
model = GrassMachine
fields = ['id', 'name', 'serie_number', 'battery_percentage', 'model', 'power', 'voltage', 'motor_type', 'cut_type', 'rotation_... | StarcoderdataPython |
1685616 | puzzle_input_list = []
with open("input.txt", "r") as puzzle_input:
for line in puzzle_input:
for digit in line:
puzzle_input_list.append(int(digit))
width = 25
height = 6
digits_per_layer = width*height
layers = [[puzzle_input_list[0]]]
counter = 1
for digit in puzzle_input_list[1:]:
if... | StarcoderdataPython |
1667385 | <filename>bootstrap_admin/__init__.py
__version__ = '0.3.7.1'
| StarcoderdataPython |
1643882 | # This file is part of GridCal.
#
# GridCal 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 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... | StarcoderdataPython |
3387023 | <gh_stars>0
#p3 size 791mm x 384mm
#sculpteo 940mm x 590
import svgwrite
#Adobe Illustrator
#72 ppi,
mm = 72 / 25.4
#manufacturer = "sculpteo"
manufacturer = "ponoko_shelf_2_riser"
node_radius_ratio = 11
node_length = 7
opening_length = 1898.65
max_shelf = 316.65
if manufacturer == "sculpteo":
join_width = 6... | StarcoderdataPython |
3282468 | <reponame>lyw07/kolibri
import os
import time
from django.apps.registry import AppRegistryNotReady
from django.core.management import call_command
from django.http.response import Http404
from django.utils.translation import gettext_lazy as _
from iceqube.classes import State
from iceqube.exceptions import JobNotFound... | StarcoderdataPython |
1670241 | <gh_stars>10-100
# 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
#... | StarcoderdataPython |
1797659 | from .trainer_pushpull import *
from .trainer_lasso import *
| StarcoderdataPython |
127038 | <reponame>willingc/escapement<filename>escapement/cli.py
"""Console script for escapement."""
import sys
import click
from .escapement import escapement
@click.command()
def main(args=None):
"""Console script for escapement."""
click.echo("Escapement: Understand your projects")
escapement()
return 0
... | StarcoderdataPython |
1690752 | # Copyright (c) 2019 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | StarcoderdataPython |
198037 | <reponame>Bhanditz/spyder<filename>spyder/widgets/tests/test_findinfiles.py
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Tests for findinfiles.py
"""
# Test library imports
import os
import pytest
import os.path as osp
from pytestqt import qtb... | StarcoderdataPython |
157579 | <filename>spark/spark_streaming/src/main.py
from com.example.app.streaming_app import StreamingApp
from com.example.handler.spark import Spark
Spark.start_streaming(StreamingApp().handler)
#StreamingApp().handler
| StarcoderdataPython |
147924 | <gh_stars>1-10
# MIT License
#
# Copyright (c) 2021 Emc2356
#
# 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, modi... | StarcoderdataPython |
52081 | '''
0052. N-Queens II
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return the number of distinct solutions to the n-queens puzzle.
Example:
Input: 4
Output: 2
Explanation: There are two distinct solutions to the 4-queens puz... | StarcoderdataPython |
3316500 | <reponame>FarhanShoukat/DigitRecognition1438
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
from sklearn.metrics import accuracy_score
from datetime import datetime
import time
fmt = '%H:%M:%S'
def get_current_time():
time.ctime()
return time.strftime(f... | StarcoderdataPython |
1762982 | #!/usr/bin/env python
#
# XML Parser.
# file : XmlParser.py
# author : <NAME> <<EMAIL>>
# since : 2011-07-20
# last modified : 2011-07-22
from xml.dom.minidom import parse
from lib.Functions import asciify
class XmlDataFormatException(Exception):
"""Xml file is not valid """
... | StarcoderdataPython |
1600169 | <reponame>rwtaylor/mpcr-analyses-pipelines
#!/usr/bin/env python3
import sys
import re
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# This is copied from https://github.com/lh3/readfq
# Fast parsing of fasta/fastq
def readfq(fp): # this is a generator function
last = None # this i... | StarcoderdataPython |
22981 | <gh_stars>1-10
# Copyright (c) 2020. <NAME>, Ghent University
from os.path import join as jp
import numpy as np
from tomopal.crtomopy.crtomo.crc import (
Crtomo,
datread,
import_res,
mesh_geometry,
mtophase,
)
from ..parent import inventory
from ...geoview.diavatly import model_map # To plot re... | StarcoderdataPython |
3217403 | # -*- coding: utf-8 -*-
#
# Copyright 2017-2019 Data61, CSIRO
#
# 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 ... | StarcoderdataPython |
4832612 | import sys
import pytest
sys.path.append(".")
sys.path.append("..")
sys.path.append("../..")
from Hologram.Network import NetworkManager
class TestNetworkManager(object):
def test_create_non_network(self):
networkManager = NetworkManager.NetworkManager(None, '')
assert networkManager.networkActiv... | StarcoderdataPython |
3307810 | from keras.layers import ZeroPadding2D, BatchNormalization, Input, MaxPooling2D, AveragePooling2D, Conv2D, LeakyReLU, Flatten, Conv2DTranspose, Activation, add, Lambda, GaussianNoise, merge, concatenate, Dropout
from keras_contrib.layers.normalization import InstanceNormalization
from keras.layers.core import Dense, Fl... | StarcoderdataPython |
3371846 | <reponame>22014471/malonghui_Django<filename>back_end/mlh/apps/activity/views.py
from django.shortcuts import render
# Create your views here.
from rest_framework.generics import ListAPIView, RetrieveAPIView
from activity.models import Activity
from activity.serializers import ActivitySerializer, ActivityDetailSeria... | StarcoderdataPython |
3347123 | # -*- coding:utf-8 -*-
# !/usr/bin/env python3
"""Tail
Usage:
tail <filename> [-n=<n>] [--encoding=<encoding>] [--no-more]
Options:
-n=<n> head number of the file [default: 5].
--encoding=<encoding> point the encoding of the file manually
--no-more don't use `more` to s... | StarcoderdataPython |
1791434 | <gh_stars>0
#---- Class to hold information about a generic network device --------
class NetworkDevice():
def __init__(self, name, ip, user='cisco', pw='cisco'):
self.name = name
self.ip_address = ip
self.username = user
self.password = pw
self.os_type = 'unknown'
#---- C... | StarcoderdataPython |
1731822 | from django.shortcuts import render
from django.http import JsonResponse
from django.http import HttpResponseBadRequest
from django.db.models import Count
from HMBBF.models import home_ad
from HMBBF.models import home_news
from HMBBF.models import home_Keyword
from HMBBF.models import Guest
from HMBBF.models import Th... | StarcoderdataPython |
192025 | import pymongo
from bson import ObjectId, json_util
from datetime import date
import json
import os
class DBService:
def __init__(self):
self.db = pymongo.MongoClient(os.environ["MONGO"]).slrdb
###############
# COLLABS #
###############
def add_collab_to_project(self, project_id, us... | StarcoderdataPython |
140084 | <gh_stars>1-10
"""
doa.py
Direction of arrival (DOA) estimation.
Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
Written by <NAME> <<EMAIL>>
"""
import os
import math
import numpy as np
import scipy
_TOLERANCE = 1e-13
def load_pts_on_sphere(name='p4000'):
"""Load points on a unit sphere
... | StarcoderdataPython |
76507 | <reponame>dcompane/controlm_py
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.220
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unitte... | StarcoderdataPython |
1634793 | <filename>qmctorch/sampler/metropolis.py
from tqdm import tqdm
import torch
from torch.distributions import MultivariateNormal
from time import time
from typing import Callable, Union, Dict
from .sampler_base import SamplerBase
from .. import log
class Metropolis(SamplerBase):
def __init__(self,
... | StarcoderdataPython |
4840415 | from google_hangouts_chat_bot.commands import Commands
from google_hangouts_chat_bot.event_handler import EventHandler
from tests.functional.helpers import load_payload
def test_added_to_room():
payload = load_payload("added_to_room")
expected = {
"text": "Hello people! Thanks for adding me to *Testi... | StarcoderdataPython |
152357 | <reponame>HPCToolkit/hpctest
#====================#
# AMGMK PACKAGE FILE #
#====================#
from spack import *
class Amgmk(MakefilePackage):
""" This microkernel contains three compute-intensive sections of the larger AMG benchmark.
Optimizing performance for these three sections will improve the ... | StarcoderdataPython |
3325203 | import numpy as np
import os
import random
import cv2
import operator
import json
import time
from utils.tools import normalization, augment_bbox
# Change this path to the users own dataset path
desktop_path = os.path.expanduser("~\Desktop")
seq_path = os.path.join(desktop_path, "dataset", 'MOT')
class data():
d... | StarcoderdataPython |
163906 | #Crie um pgm que leia dois valores e mostre um menu na tela:
'''[1]somar
[2]multiplicar
[3]maior
[4]novos numeros
[5]sair do programa'''
#seu pgm deverá realizar a operação solicitada em cada caso
from time import sleep
opção = 0
n1 = int(input('1º VALOR: '))
n2 = int(input('2ª VALOR: '))
while opção != 5:
print(''... | StarcoderdataPython |
3262771 | <reponame>for-code0216/PoseNAS
""" Training augmented model """
import os
import sys
import argparse
import time
import glob
import numpy as np
import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
from tensorboardX import Su... | StarcoderdataPython |
139382 | <filename>fedml_api/distributed/fedavg_robust/FedAvgRobustAPI.py
from mpi4py import MPI
from fedml_api.distributed.fedavg_robust.FedAvgRobustAggregator import FedAvgRobustAggregator
from fedml_api.distributed.fedavg_robust.FedAvgRobustClientManager import FedAvgRobustClientManager
from fedml_api.distributed.fedavg_rob... | StarcoderdataPython |
60454 | <reponame>mercycoach/FlaskTemplatelApp
# -*- coding: utf-8 -*-
"""Public section, including homepage and signup."""
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask_login import login_required, login_user, logout_user, current_user
from diytravelsite.extensions import login_ma... | StarcoderdataPython |
3209270 | WEATHER = [
"rainy",
"thunderstorms",
"sunny",
"dusk",
"dawn",
"night",
"snowy",
"hazy rain",
"windy",
"partly cloudy",
"overcast",
"cloudy",
]
| StarcoderdataPython |
26917 | from __future__ import division
from netCDF4 import Dataset
import glob,os.path
import numpy as np
import numpy.ma as ma
from scipy.interpolate import UnivariateSpline
from matplotlib import cm
from matplotlib import ticker
import matplotlib.pyplot as plt
#import site
#site.addsitedir('/tera/phil/nchaparr/SAM2/sam_main... | StarcoderdataPython |
1766911 | <filename>oldcode/bool_parser.py
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 12 16:40:16 2015
@author: noore
"""
from pythonds.basic.stack import Stack
import re
import numpy as np
class BoolParser(object):
PREC = {'(': 1, ')': 1, 'and' : 2, 'or' : 2}
@staticmethod
def isBoolVariable(token):... | StarcoderdataPython |
1674900 | <reponame>Berailitz/bupt-passport<filename>passport/mess.py
"""Utils."""
import datetime
import functools
import itertools
import logging
import logging.handlers
import threading
import time
from typing import Callable
get_current_time = lambda: time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
def set_log... | StarcoderdataPython |
1670558 | import numpy as np
import pandas as pd
import random
ENG_INPUT_PATH = 'eng\English Wordlist.csv'
DEU_INPUT_PATH = 'deu\GoetheA1.csv'
JAP_INPUT_PATH = 'eng\AdvanceIELTS.csv'
file_lst = ['eng\English Wordlist.csv','deu\GoetheA1.csv','eng\AdvanceIELTS.csv', 'deu\Duolingo.csv']
class WordGenerator:
input_df = ''
i... | StarcoderdataPython |
6820 | <filename>dlk/core/schedulers/__init__.py
# Copyright 2021 cstsunfu. 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 |
1625937 | <reponame>zigonk/MST_inpainting<filename>utils/utils.py
import math
import os
import sys
import time
import numpy as np
import torch
import torch.nn.functional as F
import torchvision.transforms.functional as FF
import yaml
from PIL import Image
from torch.optim.lr_scheduler import LambdaLR
class Config(object):
... | StarcoderdataPython |
3372408 | <gh_stars>100-1000
"""\
Code generator functions for wxTextCtrl objects
@copyright: 2002-2007 <NAME>
@copyright: 2014-2016 <NAME>
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import common
import wcodegen
class PythonTextCtrlGenerator(wcodegen.PythonWidgetCodeWriter):
tmpl = '%(name... | StarcoderdataPython |
3298418 | from random import randint
print('-='*20)
print('VAMOS JOGAR PAR OU IMPAR')
print('-='*20)
v = 0
while True:
numero = int(input('Digite um numero'))
computador = randint(0, 11)
escolha = ' '
total = numero+computador
while escolha not in 'PI':
escolha = str(input('Par ou Impar? [P... | StarcoderdataPython |
1696749 | <gh_stars>0
from direction import Direction
from gpiozero import Robot
from motor import Motor
import os
from dotenv import load_dotenv
load_dotenv()
class Rover:
def __init__(self) -> None:
self.rv = Robot(
(os.getenv('MOTOR_A_FL'), os.getenv(
'MOTOR_A_RL'), os.getenv('MOTOR_... | StarcoderdataPython |
1713482 | class ProcessNotFoundError(Exception):
"""Raised when a process is not found"""
pass
class ProcessServiceError(Exception):
"""Raised when an error happen when running a process"""
pass
| StarcoderdataPython |
3300904 | def substitute_dict(d, replacement):
return dict( (k, ((d[k] in replacement) and replacement[d[k]] or d[k])) for k in d )
x = { "foo": "bar", "bum": "butt" }
y = { "butt": "poo" }
print substitute_dict(x, y)
| StarcoderdataPython |
32767 | """ This Script contain the different function used in the framework
part1. Data processing
part2. Prediction and analisys
part3. Plotting
"""
import numpy as np
import librosa
import matplotlib.pyplot as plt
from sklearn import metrics
import os
import pickle
import time
import struct
""" Data processing """
def g... | StarcoderdataPython |
193757 | """Template Tags"""
import itertools
from importlib import import_module
from collections import OrderedDict
from django.apps import apps
from django import template
from activflow.core.constants import REQUEST_IDENTIFIER
from activflow.core.helpers import (
activity_config,
wysiwyg_config
)
from activflow.... | StarcoderdataPython |
48983 | <gh_stars>1-10
from datetime import datetime
from pyboletox.Contracts.Cnab.Retorno.Cnab400.detalhe import Detalhe as DetalheContract
from pyboletox.magicTrait import MagicTrait
class Detalhe(MagicTrait, DetalheContract):
def __init__(self) -> None:
super().__init__()
self._carteira = None
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.