id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1711804
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for # full license information. import os import sys import time import asyncio import logging import threading from random import randint from six.moves import input from datetime import datetime fro...
StarcoderdataPython
64216
<gh_stars>1-10 import pandas as pd import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression titanicData = pd.read_csv('train.csv') # show missing data # sns.heatmap(train.isnull(), yticklabels=False, cbar=False, cmap='viridis') sns.set_style('whit...
StarcoderdataPython
1635645
#!/usr/bin/env python # encoding: UTF-8 """Test demo 13.1 for chapter 13.""" class AddrBookEntry(object): """Address book entry class.""" def __init__(self, nm, ph): u"""构造器.""" self.name = nm self.phone = ph print("Created instance of {0}".format(self.name)) def update_...
StarcoderdataPython
1624592
<gh_stars>0 import unittest from bread import * from fractions import Fraction class TestBotMethods(unittest.TestCase): def test_is_nut(self): self.assertTrue(is_nut('Almond')) self.assertTrue(is_nut('Hazelnut')) self.assertFalse(is_nut('')) def test_get_flavor_amount(self): self.assertTrue(get_flavor_amount...
StarcoderdataPython
1704318
import sys for i in range(int(sys.stdin.readline())): b, w = map(int, sys.stdin.readline().split()) bc, wc, z = map(int, sys.stdin.readline().split()) if bc >= wc+z: bc = wc+z if wc >= bc+z: wc = bc+z print(b*bc+w*wc)
StarcoderdataPython
1698197
<reponame>cometaj2/hcli_core<gh_stars>0 from __future__ import absolute_import, division, print_function import os import sys import subprocess from setuptools import setup, find_packages from codecs import open from os import path from hcli_core import package if sys.argv[-1] == 'publish': branch = subprocess.c...
StarcoderdataPython
60937
from django.test import TestCase, RequestFactory from authors.apps.authentication.views import RegistrationAPIView, VerificationAPIView from authors.apps.articles.views import UpdateArticleAPIView, ArticleCreateAPIView import json from minimock import Mock import smtplib from rest_framework import exceptions, authentic...
StarcoderdataPython
186843
<filename>tools/perf/page_sets/rendering/key_idle_power_cases.py<gh_stars>1000+ # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from page_sets import android_screen_restoration_shared_state from page_sets.r...
StarcoderdataPython
4840050
<filename>examples/python/python_example.py # Limbus - A cross-platform multimedia library. # Written in 2014 by <NAME> <EMAIL> # # To the extent possible under law, the author(s) have dedicated all copyright # and related and neighboring rights to this software to the public domain worldwide. # This software is distr...
StarcoderdataPython
1792148
#!/usr/bin/env python # coding: utf-8 from pydub import AudioSegment import pandas as pd def read_csv(csv): return pd.read_csv(csv, sep='\t') def slice_stimuli(audio, onset, offset, number, correct, savedir): # pydub does things in milliseconds onset = onset * 1000 offset = offset * 1000 wav = A...
StarcoderdataPython
21592
<reponame>aguzev/sql-server-samples<filename>samples/features/sql-big-data-cluster/security/encryption-at-rest-external-key-provider/kms_plugin_app/custom_akv.py # Placeholder for adding logic specific to application # and backend key store. # import os import json import sys from azure.identity import DefaultAzureCred...
StarcoderdataPython
3216484
import argparse import glob import os import orjson as json import ntpath import pathlib import queue import redis import requests import shutil import sys import threading import time import yaml import pickle from bmt import Toolkit from collections import defaultdict from enum import Enum from io import StringIO fro...
StarcoderdataPython
11622
# Script to generate the necessary grammar rules for the # markov generator output type # Dataset: # http://www.drmaciver.com/2009/12/i-want-one-meelyun-sentences/ import re ALPHA = ' abcdefghijklmnopqrstuvwxyz' # read data from file with open('sentences', 'r', encoding="utf8") as f: content = f.read().splitlin...
StarcoderdataPython
139430
import json def application(environ, start_response): try: request_body_size = int(environ.get('CONTENT_LENGTH', 0)) except (ValueError): request_body_size = 0 request_body = environ['wsgi.input'].read(request_body_size) reqj = json.loads(request_body) res = { "result": 0 } fo...
StarcoderdataPython
1776058
#!/usr/bin/env python import os from stat import * def parent(path): """Return the parent of the specified directory""" # Remove the trailing slash, if any if path.endswith('/'): return os.path.dirname(path[:-1]) else: return os.path.dirname(path) def create_and_set_permissions(di...
StarcoderdataPython
3219400
<reponame>mittalkartik2000/lbry-sdk<filename>lbry/tests/integration/test_sync.py<gh_stars>0 import asyncio from lbry.testcase import CommandTestCase from binascii import unhexlify class WalletSynchronization(CommandTestCase): SEED = "carbon smart garage balance margin twelve chest sword toast envelope bottom stom...
StarcoderdataPython
99055
from datetime import date import pytest import mock from wtforms.validators import StopValidation, ValidationError import dmutils.forms.validators from dmutils.forms.validators import ( GreaterThan, DateValidator, ) @pytest.fixture def form(): return mock.MagicMock() @pytest.fixture def field(form): ...
StarcoderdataPython
3241137
#!/usr/bin/env python # encoding: utf-8 """ intersection-of-two-linked-lists.py Created by Shuailong on 2016-02-27. https://leetcode.com/problems/intersection-of-two-linked-lists/. """ ''' Try to find a O(1) space, O(n) time solution. ''' # Definition for singly-linked list. class ListNode(object): def __i...
StarcoderdataPython
1725321
import numpy as np from collections import OrderedDict #import pypospack.potential as potential if __name__ == "__main__": symbols = ['Si'] parameter_names = [ 'SiSiSi_epsilon', 'SiSiSi_sigma', 'SiSiSi_a', 'SiSiSi_lambda', 'SiSiSi_gamma', 'SiSiSi_costheta0', ...
StarcoderdataPython
1615790
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import numpy as np from numba import decorators from numba.codegen.llvmcontext import LLVMContextManager from numba.minivect import minitypes from . import _internal try: ptr_t = long except NameError: ptr_...
StarcoderdataPython
1994
# -*- coding: utf-8 -*- # @Author: GXR # @CreateTime: 2022-01-20 # @UpdateTime: 2022-01-20 import redis import config import cookie_login from cookie_api import app red = redis.Redis( host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.REDIS_DB, decode_responses=True, ) # 刷新cookie数量 def cooki...
StarcoderdataPython
4835330
<reponame>earthnet2021/earthnet-models-pytorch<gh_stars>0 from typing import Optional, Union import abc import torch from torch import nn import torch.nn.functional as F import torch.distributions as distrib from earthnet_models_pytorch.task.shedule import WeightShedule def make_normal_from_raw_params(raw_par...
StarcoderdataPython
1770508
<filename>rnbgrader/tests/test_grader.py """ Test grader module """ from os.path import join as pjoin, dirname from io import StringIO import re from hashlib import sha1 from glob import glob from copy import deepcopy import numpy as np from rnbgrader import JupyterKernel from rnbgrader.grader import (OPTIONAL_PROMP...
StarcoderdataPython
3233711
from unittest import mock from theia.query import Query, ResultHandler from theia.comm import Client @mock.patch.object(Client, 'close') @mock.patch.object(Client, 'is_open') def test_result_handler_cancel(m_is_open, m_close): m_is_open.return_value = True rh = ResultHandler(client=Client(loop=None, host=...
StarcoderdataPython
149001
from launch import LaunchDescription import launch_ros.actions def generate_launch_description(): return LaunchDescription([ launch_ros.actions.Node( node_namespace= "turtlesim1", package='turtlesim', node_executable='turtlesim_node', output='screen'), launch_ros.actions.Node( ...
StarcoderdataPython
1659733
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from mapentity.filters import MapEntityFilterSet from geotrek.common.models import Organism from geotrek.common.filters import StructureRelatedFilterSet from geotrek.core.filters import TopologyFilter, PathFilterSet from geotrek.infrast...
StarcoderdataPython
82876
<gh_stars>1-10 from pathlib import Path from part_map.part_map import PartObject def test_load_from_excel(): obj = PartObject.from_excel( Path(__file__).parent.parent.joinpath("examples", "artix7_example.xlsx") ) assert obj.get_number_of_pins() == 238 def test_load_from_json(): obj = PartOb...
StarcoderdataPython
1662026
# -*- coding: utf-8 -*- # Author: <NAME> <<EMAIL>> # Changes, Additions: <NAME> <<EMAIL>>, <NAME> <<EMAIL>> # This file is placed into the public domain. import logging import os import sys from itertools import filterfalse from pathlib import Path from subprocess import STDOUT, CalledProcessError, check_out...
StarcoderdataPython
3390640
from __future__ import absolute_import, division, print_function from telnyx.api_resources.abstract import ListableAPIResource class AvailablePhoneNumber(ListableAPIResource): OBJECT_NAME = "available_phone_number"
StarcoderdataPython
1780133
<filename>scripts/run_blocksworld.py<gh_stars>0 #!/usr/bin/env python from stripstream.pddl.logic.predicates import EasyPredicate as Pred from stripstream.pddl.objects import EasyType as Type, EasyParameter as Param from stripstream.pddl.logic.connectives import Not, And from stripstream.pddl.operators import Action f...
StarcoderdataPython
37086
import ansiblemetrics.utils as utils from ansiblemetrics.ansible_metric import AnsibleMetric class NumIncludedVars(AnsibleMetric): """ This class measures the number of included variables in a playbook. """ def count(self): """Return the number of included variables. Example ----...
StarcoderdataPython
1743820
import sys import os import time import math import numpy as np import itertools import struct # get_image_size import imghdr # get_image_size #<annotation> # <filename>000001</filename> # <source> # <database>Unknown</database> # </source> # <size> # <width>353</width> # <height>5...
StarcoderdataPython
3283730
<reponame>heartwill143/libnacl # -*- coding: utf-8 -*- ''' High level classes and routines around public key encryption and decryption ''' # import libnacl libs import libnacl import libnacl.utils import libnacl.encode import libnacl.dual import libnacl.base class PublicKey(libnacl.base.BaseKey): ''' This cla...
StarcoderdataPython
72262
<gh_stars>1-10 from __future__ import unicode_literals from django.contrib import admin from reversion.admin import VersionAdmin from stagecraft.apps.datasets.models.data_set import DataSet from stagecraft.apps.datasets.models.data_type import DataType class DataSetInline(admin.StackedInline): model = DataSet ...
StarcoderdataPython
3369334
<filename>rmgweb/pdep/migrations/0001_initial.py # Generated by Django 2.2 on 2019-11-01 13:57 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import rmgweb.pdep.models class Migration(migrations.Migration): initial = True dependencies = [ ...
StarcoderdataPython
3286632
# Generated by Django 3.1.3 on 2021-01-07 01:00 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0003_auto_20210107_0144'), ] operations = [ migrations.RemoveField( model_name='restaurante', name='location_url', ...
StarcoderdataPython
3222443
<gh_stars>0 """Solutions to Hubs chapter.""" import matplotlib.pyplot as plt import networkx as nx import pandas as pd import nxviz as nv # from nxviz import annotate from nams import ecdf def rank_ordered_neighbors(G): """ Uses a pandas Series to help with sorting. """ s = pd.Series({n: len(list(G....
StarcoderdataPython
3240655
<filename>dataloaders/ofos.py from torch.utils.data import Dataset, ConcatDataset from torch.utils.data.dataloader import DataLoader from torch.utils.data.sampler import RandomSampler, SequentialSampler from madmom.audio.signal import FramedSignal import madmom.audio.spectrogram as mmspec from madmom.io import midi fro...
StarcoderdataPython
3229254
<gh_stars>1-10 from fastNLP import Vocabulary , DataSet , Instance from config import C import os import fitlog import pdb import pickle from utils import logger import random from opencc import OpenCC chinese_converter = OpenCC("t2s") fitlog.commit(__file__) def is_chinese_char(c): #return '\u4e00' <= c and c <= '...
StarcoderdataPython
88096
import sys import stable_baselines sys.path.append("../../../k_road/") import numpy as np from stable_baselines.common.vec_env import DummyVecEnv from stable_baselines.ddpg.noise import ( OrnsteinUhlenbeckActionNoise, ) from stable_baselines import DDPG # from cavs_environments.vehicle.deep_road.deep_road impo...
StarcoderdataPython
4630
import base64 import mimetypes import os from django.conf import settings from django.http import Http404, HttpResponse from django.shortcuts import get_object_or_404 from django.views.decorators.cache import cache_control from django.views.static import serve as django_serve from database_files.models import File ...
StarcoderdataPython
114692
# 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 # distributed under the...
StarcoderdataPython
1736371
from flask import Blueprint, jsonify, url_for, request, make_response, abort, render_template, redirect from flask_login import current_user from flask_swagger import swagger from portality.api.v2 import DiscoveryApi, DiscoveryException from portality.api.v2 import ApplicationsCrudApi, ArticlesCrudApi, JournalsCrudAp...
StarcoderdataPython
34542
<gh_stars>100-1000 # 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 writi...
StarcoderdataPython
1666262
<reponame>geometrikal/IIC-1<gh_stars>0 from multiprocessing import Process, cpu_count, JoinableQueue import skimage.io as skio import numpy as np from tqdm import tqdm def produce(producer_queue, data, workers): for datum in data: producer_queue.put(datum) [producer_queue.put(None) for i in range(work...
StarcoderdataPython
1752398
''' The :mod:`pygslib.transformations` module is for calculating GSLIB rotations and transformations. ''' from __future__ import absolute_import, division, print_function from .rotations import * from .transformations import *
StarcoderdataPython
4805251
<reponame>groundupnews/gu # Generated by Django 3.0.10 on 2021-03-11 14:22 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('payment', '0007_commission_split'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
1629729
<filename>hospital/migrations/0014_doctorprescriptions.py # Generated by Django 3.2.9 on 2022-01-17 09:31 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('hospital', '0013_appointments_meeting...
StarcoderdataPython
3209041
""" 给定一个字符串str,如果str符合日常书写的整数形式,并且属于32位整数的范围, 返回str所代表的整数值,否则返回0. 举例: str = '123',返回123 str = '023',返回0 str = 'A13',返回0 str = '0',返回0 str = '2147483647',返回2147483647 str = '2147483648',返回0 str = '-123',返回-123 """ class IntegerGenerater: @classmethod def get_integer(cls, str1): if not str1 or str1[0] ...
StarcoderdataPython
3245589
#!/usr/bin/env python # filename: stash_repo_builder.py # # desc: First run, it will generate repo template as initial template, # after this it will generate latest repo template. and then it will compare # initial repo template and latest repo template and write differences into html. # import os import sys import d...
StarcoderdataPython
4821967
<reponame>frongk/twitter-pipeline from sklearn.base import TransformerMixin class TypeTransform(TransformerMixin): def __init__(self, astype=None): super().__init__() self.astype=astype def fit(self, X, y=None, **fit_parmas): return self def transform(self, X, **transform_params):...
StarcoderdataPython
1623751
<gh_stars>0 #!/usr/bin/env python """ Copyright (C) 2006 Google 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 ...
StarcoderdataPython
104398
<filename>database/users.py import sqlalchemy from flask_login import UserMixin from sqlalchemy import orm from sqlalchemy_serializer import SerializerMixin from .db_sess import SqlAlchemyBase class User(SqlAlchemyBase, UserMixin, SerializerMixin): __tablename__ = 'users' id = sqlalchemy.Column(sqlalchemy.I...
StarcoderdataPython
43908
# (C) Copyright 1996-2018 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergov...
StarcoderdataPython
3203363
import io import os import json import oci from fdk import response from base64 import b64decode, b64encode def handler(ctx, data: io.BytesIO=None): iot_key = "mykey" iot_data = "mydata" stream_ocid = os.getenv('OCIFN_STREAM_OCID') stream_endpoint = os.getenv('OCIFN_STREAM_ENDPOINT') fnErrors = "...
StarcoderdataPython
3345552
#!/usr/bin/python3 import sys, argparse, requests, json from auth import reef_pi_secrets def main(argv): if not validate_auth(): print("auth/reef_py_secrets.py must be updated with a valid userid and password") exit(1) parse_args(argv) switcher = { "list": list_handler, "...
StarcoderdataPython
3316289
# -*- coding: utf-8 -*- # pylint: disable=invalid-name,missing-docstring import datetime from unittest import mock def test_job_control(flask_app, researcher_1, test_root, db): # pylint: disable=invalid-name from app.modules.asset_groups.models import AssetGroup, AssetGroupSighting from app.modules.job_co...
StarcoderdataPython
1609763
# 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 class Solution: def hasPathSum(self, root: Optional[TreeNode], targetSum: int) -> bool: if not root: ret...
StarcoderdataPython
1680724
<reponame>Ar4ikov/mavapi<filename>mavapi/exceptions.py class MAVAPIExceptions(Exception): pass class MAVAPIError(MAVAPIExceptions): WRONG_ACCESSTOKEN = {'status': 'error', 'error_code': 4, 'error_msg': 'Wrong access_token.'} NO_ACCESSTOKEN = {'status': 'error', 'error_code': 3, 'error_msg': "Token i...
StarcoderdataPython
30916
import os from json import JSONDecodeError from json import dump from json import load import numpy as np from core.net_errors import JsonFileStructureIncorrect, JsonFileNotFound def upload(net_object, path): if not os.path.isfile(path): raise JsonFileNotFound() try: with open(path, 'r') as...
StarcoderdataPython
3310439
from rest_framework.viewsets import ReadOnlyModelViewSet from rest_framework.response import Response from kolibri.core.content.models import ContentNode from kolibri.core.content.api import ContentNodeProgressViewset from kolibri.core.content.serializers import ContentNodeSlimSerializer class KnowledgeMapViewset(Rea...
StarcoderdataPython
1758034
# imports import json import os import os.path import re import shutil import stat import urllib.parse #@<> INCLUDE dump_utils.inc #@<> deploy sandbox testutil.deploy_raw_sandbox(__mysql_sandbox_port1, "root") shell.connect(__sandbox_uri1) dumpdir = os.path.join(__tmp_dir, "dumptests") shutil.rmtree(dumpdir, True) ...
StarcoderdataPython
57892
<filename>python/dictionary.py<gh_stars>0 Dict = {'Tim': 18,'Charlie':12,'Tiffany':22,'Robert':25} Boys = {'Tim': 18,'Charlie':12,'Robert':25} Girls = {'Tiffany':22} studentX=Boys.copy() studentY=Girls.copy() print(studentX) print(studentY) students = list(Dict.keys()) students.sort() for s in students: print(":...
StarcoderdataPython
3347114
from LogicAPI import Term, Var, query, Cut, _, Func, BoolFunc, Object A, B, V, P = Var('A'), Var('B'), Var('V'), Var('P') X, Y, Z = Var('X'), Var('Y'), Var('Z') Action, C, Plan = Var('Action'), Var('C'), Var('Plan') Start, End = Var('Start'), Var('End') L2 = Var('L2') L3 = Var('L3') H = Var('H') T = Var('T') L = Var('...
StarcoderdataPython
3277464
from data.entities import Entity class Obstacle(Entity): """Base blocking, visible, non-liftable, non-usable entity for subclassing.""" def init(self): super(Obstacle,self).init() self.set_attributes('01100') self.char = 'O' class Boulder(Obstacle): pass
StarcoderdataPython
1664327
from datetime import datetime from flask_login import UserMixin,current_user from werkzeug.security import generate_password_hash,check_password_hash from app import db,login_manager #user authentication class User(UserMixin,db.Model): __tablename__ = 'users' id = db.Column(db.Integer,primary_key = True...
StarcoderdataPython
1782079
import matplotlib matplotlib.use('Agg') import PID import time import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import spline P = 1.4 I = 1 D = 0.001 pid = PID.PID(P, I, D) pid.SetPoint = 0.0 pid.setSampleTime(0.25) # a second total_sampling = 100 sampling_i = 0 measurement = 0 feedback = ...
StarcoderdataPython
65800
<filename>fltk/datasets/dataset.py from abc import abstractmethod import torch from torch.utils.data import DataLoader from torch.utils.data import TensorDataset from fltk.util.config import DistLearningConfig class Dataset: def __init__(self, config, learning_params: DistLearningConfig, rank: int, world_size:...
StarcoderdataPython
1751741
<reponame>howiworkdaily/scofield-project from django.conf.urls.defaults import * urlpatterns = patterns('product.views', url(r'^(?P<product_slug>[-\w]+)/$', 'get_product', {}, 'scofield_product'), )
StarcoderdataPython
110679
# Copyright 2018 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
StarcoderdataPython
3244078
<filename>tests/inferfaces_tests/test_scrobble.py import pytest from tests.test_data.scrobble import EPISODE, MOVIE1, RESP_EPISODE, RESP_MOVIE, SHOW from tests.utils import mk_mock_client from trakt.core.exceptions import ArgumentError from trakt.core.json_parser import parse_tree from trakt.core.models import Episode,...
StarcoderdataPython
88816
import redis class Cache: def __init__(self, host, port): self.conn = redis.Redis(host=host, port=port) def get(self, key): return self.conn.get(key) def sef(self, key, value): self.conn.set(key, value) def hgetall(self, key): return self.conn.hgetall(key) def hmset(self, key, value): self.conn.hms...
StarcoderdataPython
1662008
n = 20 prod = 1 def gcd(a, b): c = 0 while (a != 0): c = a a = b%a b = c return b for i in range(1, n+1, 1): if prod%i != 0 : g = gcd(i, prod) prod *= i/g print("Answer = %d" % (prod))
StarcoderdataPython
3256792
""" General UI utilities for simplifying UI creation code. """ import logging import os import traceback from functools import partial import maya.cmds as cmds from ..vendor.Qt import QtCore, QtWidgets, QtGui LOG = logging.getLogger(__name__) ICON_DIR = os.path.join(os.path.dirname(__file__), 'icons') # mel comma...
StarcoderdataPython
46110
from django.contrib.sitemaps import Sitemap from django.shortcuts import reverse class StaticViewSitemap(Sitemap): changefreq = "weekly" priority = 0.5 def items(self): return ['team_app:index'] def location(self, item): return reverse(item)
StarcoderdataPython
4813917
""" ./atoms/switch.py """ from automancy.core import Elemental class Switch(Elemental): """ Atom Elemental for switch form option DOM objects """ def __init__(self, locator: str, human_name: str, system_name: str): """ Represents a switch form options DOM element which can only be on or off. ...
StarcoderdataPython
27465
<reponame>richardfergie/ForecastGA<filename>test.py # Libraries import pandas as pd import numpy as np import re from datetime import datetime from dateutil.rrule import rrule, MONTHLY import matplotlib.pyplot as plt import json import forecastga import forecastga.googleanalytics as ga # Logging import logging log...
StarcoderdataPython
161801
<reponame>randlet/qatrackplus-ci from decimal import Decimal from django.core.validators import MinValueValidator from django.db import models from django.utils.translation import ugettext as _ from qatrack.units import models as u_models from qatrack.service_log import models as sl_models class Supplier(models.Mod...
StarcoderdataPython
140068
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from . import util,dataloader def default_eval(refer_loader,query_loader,model,class_acc=False): fb_vector = None if hasattr(model,'get_fb_vector'): fb_vector = get_fb_vector(refer_loader,model) centroid = g...
StarcoderdataPython
153092
from django.db import models class Email(models.Model): name = models.CharField(max_length=255, blank=True, null=True) contact = models.CharField(max_length=255) subject = models.CharField(max_length=255) message = models.TextField() meta = models.TextField(blank=True, null=True) is_sent = mo...
StarcoderdataPython
133567
import datetime import pathlib import re import packaging.version import requests import tabulate FILE_HEAD = r"""Plugins List ============ PyPI projects that match "pytest-\*" are considered plugins and are listed automatically. Packages classified as inactive are excluded. """ DEVELOPMENT_STATUS_CLASSIFIERS = ( ...
StarcoderdataPython
1752825
from mmdet.core.utils import HistogramHook class BackboneHistHook(HistogramHook): def __init__(self, model_types, save_every_n_steps, sub_modules=('backbone',)): super(BackboneHistHook, self).__init__('backbone_hist', model_types=model_types, ...
StarcoderdataPython
1750657
# input for cross-testing of test LAR files with a Python environment from larlib import * import networkx as nx lines = tuple(open("test/csv/test1.V", 'r')) V = [list(eval(line)) for line in lines] lines = tuple(open("test/csv/test1.EV", 'r')) EV = [list(eval(line)) for line in lines] VIEW(STRUCT(MKPOLS((V,[[u-1,v-1...
StarcoderdataPython
1614505
"""Module containing python functions, which generate first order Pauli kernel.""" import numpy as np import itertools from ...wrappers.mytypes import doublenp from ...specfunc.specfunc_elph import FuncPauliElPh from ..aprclass import ApproachElPh from ..base.pauli import ApproachPauli as ApproachPauliBase # ----...
StarcoderdataPython
102953
<reponame>kustodian/google-cloud-sdk # -*- coding: utf-8 -*- # # Copyright 2016 Google 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/l...
StarcoderdataPython
1781909
# Copyright 2021 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from unittest import TestCase from datetime import datetime, timedelta, timezone from uw_hrp.models import ( EmploymentStatus, JobProfile, SupervisoryOrganization, Worker, WorkerPosition, parse_date, WorkerRef) from uw_hrp.u...
StarcoderdataPython
3292537
<filename>plugins/plex-yavdr-channel.bundle/Contents/Code/__init__.py #################################################################################################### # VDR Live TV Plugin V 0.0.2 alpha # written by <NAME> in 2013/2014 # based on the Dreambox Plugin by greeny # # this is free code, do whatever you w...
StarcoderdataPython
3324537
<filename>examples/hangman/HangMan.py<gh_stars>100-1000 import pyjd # dummy in pyjs from HangManWidget import HangManWidget from pyjamas.ui.RootPanel import RootPanel class HangMan: def onModuleLoad(self): self.webspace=HangManWidget() RootPanel().add(self.webspace) if __name__ == '__main__': ...
StarcoderdataPython
3351098
<filename>.github/deploy.py #!/usr/bin/env python3 import sys import os import re import logging import pathlib import subprocess import shutil import json from datetime import datetime from mako.template import Template from enum import Enum, auto class CI(Enum): UNKNOWN = auto() TRAVIS = auto(...
StarcoderdataPython
3248915
<reponame>VaibhavBhujade/Blockchain-ERP-interoperability<filename>odoo-13.0/web_oca/web_widget_many2one_simple/__manifest__.py # Copyright 2020 Tecnativa - <NAME> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Simple many2one widget", "version": "13.0.1.0.0", "license": "AGPL-3"...
StarcoderdataPython
141451
<reponame>kubikvid/weather-this-day<filename>backend/main.py # Copyright (c) 2019. Lorem ipsum dolor sit amet, consectetur adipiscing elit. # Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. # Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. # Proin dapibus...
StarcoderdataPython
3222512
<filename>surrender/blocking_socket.py<gh_stars>10-100 # -*- coding: utf-8 -*- """ # (C) 2019 Airbus copyright all rights reserved Created on Fri Jun 8 17:33:21 2018 @author: brochard """ try: from PyQt5 import QtCore; except: from PyQt4 import QtCore; class BlockingSocket(QtCore.QIODevice): def __init...
StarcoderdataPython
1652338
from ..util import BaseCase from copy import deepcopy import pygsti.tools.listtools as lt class ListToolsTester(BaseCase): def test_remove_duplicates_in_place(self): l = [1, 2, 2, 3] l2 = deepcopy(l) lt.remove_duplicates_in_place(l2) self.assertEqual(l2, [1, 2, 3]) self.a...
StarcoderdataPython
3335548
<filename>predicteasy/core/metrics/__init__.py import pandas as pd import numpy as np from sklearn.ensemble import ExtraTreesClassifier class Scorer: """ A Scorer is a special classifier used to score for given X and y and generate statistical significance coefficients. ... Attribute...
StarcoderdataPython
166778
<reponame>meshellchoo/senior-design-project-kusa """admin URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: ...
StarcoderdataPython
3293384
<reponame>bsg-external/OpenRAM # See LICENSE for licensing information. # # Copyright (c) 2016-2019 Regents of the University of California and The Board # of Regents for the Oklahoma Agricultural and Mechanical College # (acting for and on behalf of Oklahoma State University) # All rights reserved. # import debug from...
StarcoderdataPython
3306304
<gh_stars>1-10 # -*- coding: utf-8 -*- import docreader import doc2words import pickle import mmh3 import json import sys import varbyte args = docreader.parse_command_line ().files encoder_arg = args [0] archive_args = args [1:] if encoder_arg == 'varbyte': encoder = varbyte else: pr...
StarcoderdataPython
128740
def test_get_page_hierarchy_as_xml(): given_pages('PageOne', 'PageOne.ChildOne', 'PageTwo') when_request_is_issued('root', 'type:pages') then_response_should_be_xml() def test_get_page_hierarchy_has_right_tags(): given_pages('PageOne', 'PageOne.ChildOne', 'PageTwo') when_request_is_issued('root'...
StarcoderdataPython
3201523
<reponame>BrianCarela/google-python-exercises<gh_stars>0 #!/usr/bin/python -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ """A tiny Python program to chec...
StarcoderdataPython
1646048
<reponame>dedoogong/tensorrt-detectron # encoding: utf-8 """ @author: <NAME> @contact: <EMAIL> """ from __future__ import print_function, division import sys import numpy as np import pickle import os import pickle os.environ['GLOG_minloglevel'] = '2' HOME_PATH = '/home/ktai01' caffe_root = HOME_PATH + '/caffe_vistool...
StarcoderdataPython