id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
79794
# Generated by Django 3.2.9 on 2021-11-14 08:06 from decimal import Decimal from django.db import migrations, models import djmoney.models.fields class Migration(migrations.Migration): dependencies = [ ('accounts', '0016_alter_order_location'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
58235
from typing import List from pydantic import BaseModel from watchmen_model.common import ConnectedSpaceId, DashboardId, LastVisit, UserBasedTuple class Favorite(UserBasedTuple, LastVisit, BaseModel): connectedSpaceIds: List[ConnectedSpaceId] = [] dashboardIds: List[DashboardId] = []
StarcoderdataPython
3378936
<reponame>bfournie/lldp-decode #!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
StarcoderdataPython
4830104
a = 1 # some comment b = 2
StarcoderdataPython
35772
import argparse import json parser = argparse.ArgumentParser() parser.add_argument("--text", type=str, help="path to original text file") parser.add_argument("--train", type=str, help="path to original training data file") parser.add_argument("--valid", type=str, help="path to original validation data file") parser.ad...
StarcoderdataPython
126751
<reponame>Llamasaiko/Track1_Primitive<filename>mysite/reviews/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-15 11:46 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependenci...
StarcoderdataPython
53067
# genRandInput.py - Generate ranodom input def random_inputs(N = 5, maxvarn = 4, maxs = 3): # N = size of each sample size for each kind # maxvarn = maximum variation for n # maxs = maximum value for s_i # X = type (A, B, C, D, E or F) # n = subscript # r = superscript # S = specialization ...
StarcoderdataPython
1665377
<filename>src/main.py from interface import initialize_interface from app import App # Function main creates an instance of the App class and calls its contructor (reads the data from csv file # and learns from them). After that the user interface is initialized. def main(): # Initialization of the application wit...
StarcoderdataPython
1764046
<gh_stars>0 from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from model_predict import read_xmls, get_target_image_paths, InputData, EvalSummary correct_index_map = { "763a8z0136b6aae04_20181218_042832_-329078_380494.jpg": 0, ...
StarcoderdataPython
1641843
<filename>tslib/stats.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 2 19:24:59 2019 @author: mehrdad """ from scipy import stats import numpy as np # ----- Stats and Analysis ------------------------- # def get_pdf_and_cdf(vals, bins): counts, edges = np.histogram(vals, bins) total...
StarcoderdataPython
1723265
<gh_stars>1-10 from digital_tv import DigitalTv from digital_tv_3d import DigitalTv3d def main(): # 基底クラス tv = DigitalTv('新潟') tv.display(8) # 派生クラス tv3d = DigitalTv3d('新潟') tv3d.is3d = False tv3d.display(8) tv3d.is3d = True tv3d.display(8) if __name__ == '__main__': main(...
StarcoderdataPython
86552
<gh_stars>0 import mido import tensorflow as tf import numpy as np import random """ Implementation of a converter of MIDI files to and from the event-based vocabulary representation of MIDI files according to Oore et al., 2018 Also some heloer fuctions to be able to use the transformer model properly Possible MIDI e...
StarcoderdataPython
139510
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import scarlet.scheduling.fields class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
1783774
<reponame>spacetelescope/exovetter import exovetter.centroid.fastpsffit as fpf import exovetter.centroid.covar as covar import exovetter.centroid.disp as disp import exovetter.utils as utils import matplotlib.pyplot as plt import numpy as np def compute_diff_image_centroids( time, cube, peri...
StarcoderdataPython
3231171
# encoding: utf-8 # 该文件,为无界面调度文件,以vtClient为基准, # 通过vt_setting访问远程RPC server端口,进行指令调度 # runDispatchClient.py 指令 + 参数/参数文件 # 华富资产, 李来佳 import sys import os import json from pick import pick from vnpy.rpc import RpcClient from vnpy.trader.utility import load_json class DispatchClient(RpcClient): ...
StarcoderdataPython
3285663
''' Unittests/Chemical/Proteins/peptide_list ________________________________________ Test suite for peptide containers. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' # load modules/submodules import random im...
StarcoderdataPython
114977
<reponame>joaopfonseca/research-learn """ ============================= Model search cross-validation ============================= This example illustrates the usage of model search cross-validation class. """ # Author: <NAME> <<EMAIL>> # Licence: MIT import matplotlib.pyplot as plt import pandas as pd from sklea...
StarcoderdataPython
1792257
#!/usr/bin/env python3 import os import html import signal from chwall.gui.shared import ChwallGui from chwall.wallpaper import current_wallpaper_info from chwall.utils import get_binary_path, reset_pending_list import gi gi.require_version("Gtk", "3.0") from gi.repository import Gdk, GdkPixbuf, GLib, Gtk # noqa: E...
StarcoderdataPython
1603891
<reponame>ahrvoje/colorio # -*- coding: utf-8 -*- # import matplotlib.pyplot as plt import numpy import pytest import colorio @pytest.mark.parametrize('illuminant,decimals,values', [ (colorio.illuminants.a(5e-9), 5, [0.93048, 1.12821, 1.35769]), (colorio.illuminants.d50(), 3, [0.019, 2.051, 7.778]), (col...
StarcoderdataPython
1779773
<reponame>walterjgsp/meaning class EvaluationResult: def __init__(self, individual_id: str, accuracy_test: float = -1.0, f1_test: float = -1.0): self.individual_id = individual_id self.accuracy_test = accuracy_test self.f1_test = f1_test
StarcoderdataPython
3227494
def part1(startTime, buses) -> int: from math import ceil activeBuses = list(filter(lambda x: x != "x", buses)) for i in range(len(activeBuses)): value = ceil(startTime/activeBuses[i]) * activeBuses[i] if i == 0 or (i != 0 and value < minTime): minTime = value minBus ...
StarcoderdataPython
3318553
from PIL import Image from django import forms from django.core.files import File from .models import Photo class PhotoForm(forms.ModelForm): x = forms.FloatField(widget=forms.HiddenInput()) y = forms.FloatField(widget=forms.HiddenInput()) image_width = forms.FloatField(widget=forms.HiddenInput()) image_height = ...
StarcoderdataPython
1761644
<reponame>pygeonburger/server-stats # Server stats monitor by Pigeonburger # https://github.com/pigeonburger/server-stats import psutil, json from typing import List, Union # THIS IS JUST A THING THAT ACCURATELY CONVERTS BYTES TO MB, GB, TB ETC - THE ACTUAL SERVER STATS PART IS BELOW THIS CLASS # This method of accu...
StarcoderdataPython
2279
<gh_stars>100-1000 import numpy as np import unittest from pydlm.modeler.trends import trend from pydlm.modeler.seasonality import seasonality from pydlm.modeler.builder import builder from pydlm.base.kalmanFilter import kalmanFilter class testKalmanFilter(unittest.TestCase): def setUp(self): self.kf1 ...
StarcoderdataPython
3348268
<reponame>powplowdevs/2021-2022-Projects import random #unsorted numbers numbers = [5,3,1,7,4,6,2] #swaps numbers in a list def swapPositions(list, pos1, pos2): # popping both the elements from list first_ele = list.pop(pos1) second_ele = list.pop(pos2-1) # inserting in each others positi...
StarcoderdataPython
44253
<reponame>jaemyungkim/hls4ml import numpy as np from hls4ml.model.types import CompressedType, NamedType, ExponentType, FixedPrecisionType, IntegerPrecisionType, XnorPrecisionType, ExponentPrecisionType, TensorVariable, PackedType, WeightVariable #region Precision types class PrecisionDefinition(object): def def...
StarcoderdataPython
83165
<filename>misc/calc_absorption_coeff.py import numpy as np import matplotlib.pyplot as plt import scipy.constants as const from nanowire.optics.utils.utils import get_nk import os import glob this_file = os.path.realpath(__file__) nk_dir = os.path.normpath(os.path.join(this_file, '../../nanowire/NK/')) nk_files = glob...
StarcoderdataPython
115762
import cv2 faceCascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml") img = cv2.imread(r'C:\Users\Jeevan\PycharmProjects\CartoonMaking\Resources\Sample.jpeg') img = cv2.resize(img, (800, 600)) imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # converting image into grayscal...
StarcoderdataPython
4830356
<reponame>tdilauro/library-registry """Implement logic common to more than one of the Simplified applications.""" from psycopg2 import DatabaseError import flask import json import sys from lxml import etree from functools import wraps from flask import make_response from flask_babel import lazy_gettext as _ from util....
StarcoderdataPython
1640152
<gh_stars>0 ##======================================================================================== ##======================================================================================== import numpy as np n=25 cost_out=open('cost_av.dat','w') for nh in range(0,9): cost = np.loadtxt('cost/cost_%02d.dat'%(nh...
StarcoderdataPython
1653537
<reponame>GuerrillaAnalytics/made-cli<filename>tests/commands/project_grp/test_project_functions.py """Tests for all project functions.""" import os import shutil import tempfile from made.commands.project_grp.project_functions \ import project_audit_name from made.commands.project_grp.project_functions \ impo...
StarcoderdataPython
4807859
import json import os import logging _LOGGER = logging.getLogger(__name__) def get_instance_id(): try: filename = os.environ.get("ECS_CONTAINER_METADATA_FILE") if filename is not None: _LOGGER.info("ECS_CONTAINER_METADATA_FILE %s", filename) with open(filename, encoding="u...
StarcoderdataPython
3257943
<reponame>pmay/tifinity<gh_stars>1-10 import hashlib class Checksum(): @staticmethod def checksum(tiff, alg="md5", justimage=False): hashes = { 'full': 'Unknown', 'images': 'Unknown', 'ifds': 'Unknown' } if not justimage: hashes["full"] = Chec...
StarcoderdataPython
3208873
<filename>exercises/0020-ValidParentheses/valid_parentheses.py class Solution: def isValid(self, s: str) -> bool: left = [] matches = {")": "(", "]": "[", "}": "{"} for i in s: if i in "([{": left.append(i) else: if not left: ...
StarcoderdataPython
3214900
<filename>tests/rlc/test_rlc.py # general imports from math import exp, cos, sin, sqrt from pathlib import Path # AHA imports import magma as m # msdsl imports from ..common import * from msdsl import MixedSignalModel, VerilogGenerator, AnalogSignal, Deriv NAME = Path(__file__).stem.split('_')[1] BUILD_DIR = Path(__...
StarcoderdataPython
3311881
from baxter_controller import BaxterController
StarcoderdataPython
4825539
<gh_stars>1000+ #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # 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
3244146
#Crie um algoritmo que leia um número e mostre o seu dobro, triplo e raíz quadrada. n = int(input('Digite um número: ')) d = n*2 t = n*3 rq = pow(n,(1/2)) print(f'O dobro de {n} vale {d}.') print(f'O triplo de {n} vale {t}. \nE a sua raíz quadrada vale {rq:.3f}.')
StarcoderdataPython
3387658
<filename>venv/lib/python3.9/site-packages/pyarrow/_generated_version.py # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = '7.0.0' version_tuple = (7, 0, 0)
StarcoderdataPython
3318246
<filename>2012_03_27/test_fatorial.py import unittest from fatorial import fatorial class FatorialTestCase(unittest.TestCase): def test_fatorial_1_1(self): self.assertEqual(1, fatorial(1, 1)) def test_fatorial_2_1(self): self.assertEqual(2, fatorial(2, 1)) def test_fatorial_3_1(self): ...
StarcoderdataPython
38357
import dataclasses import typing from dataclasses import dataclass from typing import List from typing import Optional from profiles.settings import DENOM_DKEY, VALUE_DKEY, GEOG_DKEY, TIME_DKEY if typing.TYPE_CHECKING: from indicators.models import CensusVariable, CKANVariable @dataclass class Datum: variab...
StarcoderdataPython
1717129
<filename>docker/zarr-to-loom/ss2_plate_zarr_to_loom.py #!/usr/bin/env python3 import os import sys import zarr import loompy import scipy as sc from scipy.sparse import coo_matrix import argparse import numpy as np def main(): description = """This script converts SS2 pipeline zarr output into loom""" pars...
StarcoderdataPython
3231595
import cv2 as cv import numpy as np import image class ColorImage(image.Image): def __init__(self, img): if len(img.shape) == 2: img = cv.cvtColor(img, cv.COLOR_GRAY2BGR) super().__init__(img) def gray(self): gray = cv.cvtColor(self.img, cv.COLOR_BGR2GRAY) gray = ...
StarcoderdataPython
138308
<gh_stars>1000+ #!/usr/bin/python3 # Copyright 2020 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. """ Wrapper around xcrun adding support for --developer-dir parameter to set the DEVELOPER_DIR environment variable, and fo...
StarcoderdataPython
1701789
from typing import TypeVar from networkx import nx _G = TypeVar("_G", nx.DiGraph, nx.Graph)
StarcoderdataPython
1786001
# problem link: https://leetcode.com/problems/word-search/ class Solution: def exist(self, board: List[List[str]], word: str) -> bool: num_r = len(board) num_c = len(board[0]) def dfs(r, c, word_seg): if len(word_seg) == 1 and board[r][c] == word_seg[0]: ...
StarcoderdataPython
3244679
<filename>DatabaseNormalizer/db_normalizer/data_loader/api_external.py # -*- coding: utf-8 -*- """ db_normalizer.data_loader.api_external -------------------------------------- Toolbox to load missing data from several table structures :authors: <NAME>, <NAME>. :licence: MIT, see LICENSE for more ...
StarcoderdataPython
3292829
<gh_stars>1-10 import uuid import pytest from sqlalchemy.exc import SQLAlchemyError from app import encryption from app.dao.service_callback_api_dao import ( save_service_callback_api, reset_service_callback_api, get_service_callback, get_service_delivery_status_callback_api_for_service) from app.mode...
StarcoderdataPython
3364377
from django import forms from .models import Venda class VendaForm(forms.ModelForm): class Meta: model = Venda fields = ( 'cliente', 'funcionario', 'animal', 'data_venda', 'preco' ) class DateInput(forms.DateInput): i...
StarcoderdataPython
82509
<reponame>luluci/util7z import re import sys from unpacker import unpacker from cli import cli class unpacker_hoge(unpacker): def make_pw(self) -> None: """ 復号用パスワードを設定する """ pw:str = "" # パスワード1 re_results = re.findall("\d{0,2}(\d{6})", self._archive_basename) for result in re_results: pw = result...
StarcoderdataPython
1769794
from django.urls import path from .views import groups, students, enums, reference app_name = "system" urlpatterns = [ # Группы path("groups/", groups.AcademicGroupList.as_view()), path("groups/<int:pk>/", groups.AcademicGroupDetail.as_view()), # Студенты path("students/<int:pk>/", students.Studen...
StarcoderdataPython
3292683
# Initial code in JAVA has copyright © 2002–2015, <NAME> and <NAME>. # A symbol table implemented using a left-leaning red-black BST. # This is the 2-3 version. RED = True BLACK = False class Node(object): key = None value = None # associated data left = None right = None color = None #color of...
StarcoderdataPython
4814376
import os import tweepy import openai from pytz import timezone from datetime import datetime, timedelta class TweepyClient: def __init__(self,consumer_key,consumer_secret,access_token,access_token_secret): # auth = tweepy.OAuth2BearerHandler(BEARER_TOKEN) # self.api = tweepy.API(auth) # se...
StarcoderdataPython
1690267
<reponame>searayeah/sublime-snippets from sys import stdin class MatrixError(Exception): def __init__(self, matrix1, matrix2): self.matrix1 = matrix1 self.matrix2 = matrix2 class Matrix: def __init__(self, lst): self.lst = [line.copy() for line in lst] self.lines = len(lst)...
StarcoderdataPython
1642242
import pytest from django.test import RequestFactory from bmh_lims.database.api.views import SampleViewSet from bmh_lims.database.models import Sample pytestmark = pytest.mark.django_db class TestSampleViewSet: def test_get_queryset(self, sample: Sample, rf: RequestFactory): view = SampleViewSet() ...
StarcoderdataPython
1737687
<gh_stars>10-100 # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (t...
StarcoderdataPython
1661685
# -*- coding: utf-8 -*- import sys import webbrowser import datetime import os.path from pathlib import Path from . import utils # ------------------------------------------- # Get today date and the file now = datetime.datetime.now() schedule_file = str(Path.home())+'/projectsSchedule.md' # ARGS # 1 OPTION # 2 PRO...
StarcoderdataPython
4827651
import src.tnet as tnet import src.CARS as cars import numpy as np import copy from src.utils import * import matplotlib as mpl from matplotlib import rc import matplotlib.pyplot as plt rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) #rc('text', usetex=True) netFile, gFile, fcoeffs, tstamp, dir_out = t...
StarcoderdataPython
1687527
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
StarcoderdataPython
122458
# Learn about functions from random import randint from objects.mario import Mario from objects.goomba import Goomba from objects.bowser import Bowser # Remember functions? We have so many print statements now, we're going to have the user press enter for each print! def user_print(string): input(string) mario =...
StarcoderdataPython
3234384
import sys from functools import reduce import pandas as pd import pymysql from data_pipeline.dtype import dtype from query_builder.core import InsertBuilder from utils.logging import init_logger from utils.s3_manager.manage import S3Manager class Processor: """ load public data from s3 origin bucket an...
StarcoderdataPython
4833120
""" WSGI config for website project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from socket import gethostbyname, gethostname from django.core.wsgi import get_wsgi_ap...
StarcoderdataPython
123757
<reponame>adgalad/Cash4Home """ Django settings for C4H project. Generated by 'django-admin startproject' using Django 1.11.4. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/...
StarcoderdataPython
1707189
"""Integration test: run experiments with some small & fast configs. Only cursory 'smoke' checks -- there are plenty of errors this won't catch.""" import os import shutil import tempfile import numpy as np import pytest import ray from ray import tune from aprl.activations.density.pipeline import density_ex from a...
StarcoderdataPython
1799222
class Transformer: __slots__ = '_name', '_func' def __init__(self, name, func): self._name = name self._func = func def transform(self, data): return self._func(data) @property def name(self): return self._name def __repr__(self): return f'<{type(self...
StarcoderdataPython
3393518
import numpy as np from scipy.ndimage import gaussian_filter import sys from scipy.spatial import Delaunay import os import subprocess #from matplotlib import image as mpimg from PIL import Image, ImageDraw import shutil GAUSS = 2 OUTDIR = 'dm/temp/' PERSISTENCE_THRESHOLD = 512 l = 512 w = 512 def...
StarcoderdataPython
4838087
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020-2021 by <NAME>. All rights reserved. This file is part # of the Robot Operating System project, released under the MIT License. Please # see the LICENSE file included as part of this package. # # author: <NAME> # created: 2020-10-27 # modified: 2020-1...
StarcoderdataPython
1734581
<filename>lib/dataset/augmentor/augmentation.py import numbers import os import warnings import numpy as np import cv2 import random import math from train_config import config as cfg ######May wrong, when use it check it def Rotate_aug(src,angle,label=None,center=None,scale=1.0): ''' :param src:...
StarcoderdataPython
3349757
<filename>statsmodels/tsa/tests/results/arima112nc_results.py import numpy as np llf = np.array([-240.79351748413]) nobs = np.array([ 202]) k = np.array([ 4]) k_exog = np.array([ 1]) sigma = np.array([ .79349479007541]) chi2 = np.array([ 31643.977146904]) df_model = np.arr...
StarcoderdataPython
3347652
# -*- coding: utf-8 -*- # # 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
121854
<gh_stars>0 """Component for the Somfy MyLink device supporting the Synergy API.""" CONF_ENTITY_CONFIG = "entity_config" CONF_SYSTEM_ID = "system_id" CONF_REVERSE = "reverse" CONF_DEFAULT_REVERSE = "default_reverse" DEFAULT_CONF_DEFAULT_REVERSE = False DATA_SOMFY_MYLINK = "somfy_mylink_data" MYLINK_STATUS = "mylink_st...
StarcoderdataPython
1797198
<filename>Dice Roller 1.2 Eng/Funcs.py import sys import os from random import * # This file is what it is, I guess I might be able to do this another way, with # classes maybe (??) But for now, I'm starting out and this works, and I can # Understand how. def toInt(In): ''' this is so if you just wr...
StarcoderdataPython
97487
<filename>wgltrace.py ########################################################################## # # Copyright 2008-2009 VMware, Inc. # All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # ...
StarcoderdataPython
1713791
import cv2 import numpy as np from ...src.move import horizontally, vertically from ..mocks.image_mock import image tranlated_image = horizontally(image, -100) (height, width) = image.shape[:2] translation_matrix = np.float32([[1, 0, -100], [0, 1, 1]]) translated_image_mock = cv2.warpAffine(image, translation_matrix,...
StarcoderdataPython
1616662
<reponame>goFrendiAsgard/kokoropy<gh_stars>1-10 from kokoropy.model import DB_Model, auto_migrate, base_url, Column, or_, and_, create_engine, MetaData, ForeignKey, func, \ Integer, String, Date, DateTime, Boolean, Upload, Text, scoped_session, sessionmaker, relationship, backref, association_proxy from ..configs.d...
StarcoderdataPython
1669909
import numpy as np from keras import backend as K from keras.models import Model from keras.losses import binary_crossentropy from keras.layers import Input, Dense, Dropout from keras.regularizers import l2 from sklearn.model_selection import train_test_split class DropoutVAE: def __init__(self, original_dim, inp...
StarcoderdataPython
123347
<gh_stars>1-10 # Generated by Django 2.2.10 on 2020-03-06 15:04 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('salespipes', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='pipeline', name='job_cand...
StarcoderdataPython
3224195
<reponame>BreadFish64/teakra #!/usr/bin/env python3 import sys import socket import struct for UDP_IP in ["192.168.1.158", "127.0.0.1"]: UDP_PORT = 8888 MESSAGE = struct.pack('<H', 0xD590) for i in range(1, len(sys.argv)): if sys.argv[i] == '-1': MESSAGE = struct.pack('<H', 0xD591) ...
StarcoderdataPython
3292899
from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template urlpatterns = patterns("", url(r"^$", direct_to_template, {"template": "about/about.html"}, name="about"), url(r"^terms/$", direct_to_template, {"template": "about/terms.html"}, name="terms"), url(r"^pri...
StarcoderdataPython
39950
# /////////////////////////////////////////////////////////////////////////// # # # # /////////////////////////////////////////////////////////////////////////// class GLLight: def __init__(self, pos=(0.0,0.0,0.0), color=(1.0,1.0,1.0)): self.pos = pos self.color = color self.ambient = (1.0...
StarcoderdataPython
67503
# Copyright (C) 2015 Nippon Telegraph and Telephone Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython
183207
<reponame>gnafit/gna<gh_stars>1-10 #!/usr/bin/env python """Check PointsToHist adapter class """ from load import ROOT as R from matplotlib import pyplot as plt import numpy as N from matplotlib.ticker import MaxNLocator import gna.constructors as C from gna.bindings import DataType from gna.unittest import * # Crea...
StarcoderdataPython
3325554
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- import os from .Utility import deep_update from .JsonAccessor.JsonAccessor import load_json class ConfigureLoader(object): CONFIG_FILENAME_DEFAULT = "ConfigDefault.json" CONFIG_FILENAME_USER = "ConfigUser.json" @staticmethod def load_file(dir...
StarcoderdataPython
3364874
import logging, json from collections import OrderedDict import utils class Vocab(object): def __init__(self, vocab_size, special_tokens=[]): self.vocab_size = vocab_size self._idx2word = {} self._word2idx = {} self._freq_dict = {} self.special_tokens = special_tokens ...
StarcoderdataPython
3352779
#!/usr/bin/env python # # Copyright 2019 GoPro Inc. # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache...
StarcoderdataPython
1767576
<filename>airflow_elt_scripts/dags/my_first_dag.py #importando as bibliotecas que vamos usar nesse exemplo from airflow import DAG from datetime import datetime, timedelta from airflow.operators.bash_operator import BashOperator #Definindo alguns argumentos básicos default_args = { 'owner': 'howard', 'depends_on_pas...
StarcoderdataPython
130051
<reponame>ajmal017/amp import datetime from typing import Union import pandas as pd from tqdm.auto import tqdm import core.finance as cfinan import helpers.dataframe as hdataf import helpers.dbg as dbg import im.common.data.load.abstract_data_loader as icdlab import im.common.data.types as vcdtyp _PANDAS_DATE_TYPE =...
StarcoderdataPython
67247
<reponame>datakortet/cmsplugin-contact<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cms', '0014_auto_20160404_1908'), ] operations = [ migrations.CreateModel(...
StarcoderdataPython
171147
# -*- coding: utf-8 -*- import json from pioreactor.pubsub import QOS from pioreactor.utils.timing import current_utc_time from pioreactor.background_jobs.subjobs.base import BackgroundSubJob from pioreactor.background_jobs.temperature_control import TemperatureController class TemperatureAutomation(BackgroundSubJob...
StarcoderdataPython
1779832
# -*- coding: utf-8 -*- BRIE = "Aged Brie" BACKSTAGE_PASS = "Backstage passes to a TAFKAL80ETC concert" SULFURAS = "Sulfuras, Hand of Ragnaros" def step_quality(item, rate=-1): item.quality = item.quality + rate if 0 <= item.quality + rate <= 50 else item.quality def update_quality(item): if item.name not...
StarcoderdataPython
1615251
<gh_stars>0 #!/usr/bin/env python3 """ This script will loop over all installed pip packages and update them to the latest available version """ import pip if __name__ == "__main__": pip_args = ['install', '-U', '--upgrade-strategy=only-if-needed'] for pkg in sorted(pip.get_installed_distributions(), key=lam...
StarcoderdataPython
3360149
#!/usr/bin/env python #-*- coding: utf-8 -*- """ xmind.core.workbook ~~~~~~~~~~~~~~~~~~~ :mod:``xmind.core.workbook`` implements the command XMind manipulations. :copyright: :license: """ __author__ = "<EMAIL> <<NAME>>" from . import Document from . import const from .mixin import Workboo...
StarcoderdataPython
1799890
<reponame>aviplane/scope_interface import labscript_utils.h5_lock from labscript_utils.ls_zprocess import ProcessTree process_tree = ProcessTree.instance() process_tree.zlock_client.set_process_name("probe-error-scope") from ScopeInterface import ScopeServer port = 2626 kserver = ScopeServer("DS1ZA205020656", port,...
StarcoderdataPython
1788511
import os import sys sys.path.append("../../common") from env_indigo import * indigo = Indigo() print("****** Arom/Dearom ********") m = indigo.loadMolecule("[As]1C=N[AsH]S=1C") origin_smiles = m.smiles() print(origin_smiles) m.aromatize() print(m.smiles()) m.dearomatize() restored_smiles = m.smiles() print(restored...
StarcoderdataPython
17356
import shapefile class Andir: def __init__(self): self.kelurahan = shapefile.Writer( 'kelurahan_andir', shapeType=shapefile.POLYGON) self.kelurahan.shapeType self.kelurahan.field('kelurahan_di_andir', 'C') self.kantor = shapefile.Writer( 'kantor_kelurahan_a...
StarcoderdataPython
1654040
class error(Exception): pass def as_fd(f): if not isinstance(f, (int, long)): try: fileno = f.fileno except AttributeError: raise TypeError("argument must be an int, or have a fileno() method.") f = f.fileno() if not isinstance(f, (int, long)): ...
StarcoderdataPython
151508
import os dataset = ['csail', 'manhattan', 'intel', 'mit'] inliers_quantity = [127, 1952, 256, 20] inliers_percentages = [0.5, 0.6, 0.7, 0.8, 0.9] sample_size = 10 outliers_quantity = [] for i in range(0, len(dataset)): outliers_quantity.append([]) for inlier_percentage in inliers_percentages: inli...
StarcoderdataPython
62768
<reponame>stonewell/python-aop<filename>pyaop/aop_module_importer.py import logging import imp import sys from .module_traverser import ModuleTraverser from .aspects.aspect_manager import AspectManager class AopModuleImporter(object): def __init__(self): super(AopModuleImporter, self).__init__() ...
StarcoderdataPython
171136
<filename>termsaverlib/common.py ############################################################################### # # file: common.py # # Purpose: holds common helper functions used by termsaver code. # # Note: This file is part of Termsaver application, and should not be used # or executed separately...
StarcoderdataPython
1654182
<reponame>ajgallego/Mask_RCNN-Cleansea # import libraries import os, sys import sys import random import math import numpy as np import scipy.misc import matplotlib import matplotlib.pyplot as plt import cv2 import json from PIL import Image, ImageDraw from tensorflow.python.framework.versions import VERSION as __versi...
StarcoderdataPython