hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
98 values
lang
stringclasses
21 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
118
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
368k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
118
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
135
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
1.05M
avg_line_length
float64
1
1.03M
max_line_length
int64
2
1.03M
alphanum_fraction
float64
0
1
5b35f92e02d1509bb6e1a0f2082c073762eff558
560
kt
Kotlin
app/app/src/main/java/com/bnsantos/offline/viewmodel/CreateCommentViewModel.kt
bnsantos/android-offline-example
8fb120535d4b791b1c232e3c80944f88adbfe0d4
[ "Apache-2.0" ]
null
null
null
app/app/src/main/java/com/bnsantos/offline/viewmodel/CreateCommentViewModel.kt
bnsantos/android-offline-example
8fb120535d4b791b1c232e3c80944f88adbfe0d4
[ "Apache-2.0" ]
null
null
null
app/app/src/main/java/com/bnsantos/offline/viewmodel/CreateCommentViewModel.kt
bnsantos/android-offline-example
8fb120535d4b791b1c232e3c80944f88adbfe0d4
[ "Apache-2.0" ]
null
null
null
package com.bnsantos.offline.viewmodel import android.arch.lifecycle.LiveData import android.arch.lifecycle.ViewModel import com.bnsantos.offline.Preferences import com.bnsantos.offline.models.Comment import com.bnsantos.offline.repository.CommentsRepository import com.bnsantos.offline.vo.Resource import javax.inject.Inject class CreateCommentViewModel @Inject constructor(private val mPrefs: Preferences, private val mRepo: CommentsRepository): ViewModel() { fun create(text: String): LiveData<Resource<Comment>> = mRepo.create(text, mPrefs.userId) }
40
135
0.832143
2a76664266eaecd15e470c455ccfe57680207c1e
5,159
java
Java
src/test/java/be/rufer/swissunihockey/endpoint/GameScheduleServiceTest.java
swissunihockey/swissunihockey-game-schedule-pdf-creator
1e01c94520737a60eef6074139a4d6870c166eb1
[ "Apache-2.0" ]
1
2015-09-19T16:03:40.000Z
2015-09-19T16:03:40.000Z
src/test/java/be/rufer/swissunihockey/endpoint/GameScheduleServiceTest.java
rufer7/swissunihockey-game-schedule-pdf-creator
a0bc1d02df589df20c8243184f36f87e0c379ed4
[ "Apache-2.0" ]
42
2015-07-08T08:38:13.000Z
2021-06-19T20:44:50.000Z
src/test/java/be/rufer/swissunihockey/endpoint/GameScheduleServiceTest.java
swissunihockey/swissunihockey-game-schedule-pdf-creator
1e01c94520737a60eef6074139a4d6870c166eb1
[ "Apache-2.0" ]
3
2016-08-23T08:30:01.000Z
2019-05-25T01:07:09.000Z
/* * Copyright (C) 2015 Marc Rufer (m.rufer@gmx.ch) * * 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 License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package be.rufer.swissunihockey.endpoint; import be.rufer.swissunihockey.TestConstants; import be.rufer.swissunihockey.client.SwissunihockeyAPIClient; import be.rufer.swissunihockey.pdf.PDFGenerator; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.time.LocalDate; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.*; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class GameScheduleServiceTest { private static final String SAMPLE_FILE_NAME = "Hornets R.Moosseedorf Worblental-1437314588.pdf"; private static final String FILE_FORMAT = "UTF-8"; private static final String ROOT_DIRECTORY = "./"; private String actualSeason; @InjectMocks private GameScheduleService gameScheduleService; @Mock private SwissunihockeyAPIClient swissunihockeyAPIClient; @Mock private PDFGenerator pdfGenerator; @Before public void init() { MockitoAnnotations.initMocks(this); Calendar calendar = Calendar.getInstance(); int season = Calendar.getInstance().get(Calendar.YEAR); if (calendar.get(java.util.Calendar.MONTH) < 5) { season -= 1; } actualSeason = String.valueOf(season); } @Test public void postConstructMethodCallsSwissunihockeyAPIClientForGettingClubsOfActualSeason() { gameScheduleService.initClubMap(); verify(swissunihockeyAPIClient).getClubsOfSeason(actualSeason); } @Test public void postConstructMethodInitializesClubMapWithDataFromSwissunihockeyAPIClient() { Map<String, String> clubs = new HashMap<>(); clubs.put(TestConstants.CLUB_ID, TestConstants.CLUB_NAME); when(swissunihockeyAPIClient.getClubsOfSeason(actualSeason)).thenReturn(clubs); gameScheduleService.initClubMap(); assertNotNull(GameScheduleService.clubs); assertEquals(clubs, GameScheduleService.clubs); } @Test public void createPDFGameScheduleForTeamCallsSwissunihockeyAPIClientForGettingTeamsCalendar() { gameScheduleService.createPDFGameScheduleForTeam(TestConstants.CLUB_ID, TestConstants.TEAM_ID); verify(swissunihockeyAPIClient).getCalendarForTeam(TestConstants.TEAM_ID); } @Test public void createPDFGameScheduleForTeamCallsPDFGeneratorWithCalendarFetchedFromAPI() { initClubMap(); when(swissunihockeyAPIClient.getCalendarForTeam(TestConstants.TEAM_ID)).thenReturn(new net.fortuna.ical4j.model.Calendar()); gameScheduleService.createPDFGameScheduleForTeam(TestConstants.CLUB_ID, TestConstants.TEAM_ID); verify(pdfGenerator).createPDFBasedCalendarForTeam(any(net.fortuna.ical4j.model.Calendar.class), eq(TestConstants.CLUB_NAME)); } private void initClubMap() { Map<String, String> clubs = new HashMap<>(); clubs.put(TestConstants.CLUB_ID, TestConstants.CLUB_NAME); GameScheduleService.clubs = clubs; } @Test public void deleteOldUnusedFilesDeletesUnusedFilesOlderThanFifteenMinutesInRootDirectory() throws FileNotFoundException, UnsupportedEncodingException { PrintWriter writer = new PrintWriter(SAMPLE_FILE_NAME, FILE_FORMAT); writer.close(); File file = new File(ROOT_DIRECTORY + SAMPLE_FILE_NAME); boolean lastModifiedSet = file.setLastModified(LocalDate.now().minusDays(1).toEpochDay()); gameScheduleService.deleteOldUnusedFiles(); assertTrue(lastModifiedSet); assertFalse((new File(String.format("./%s", SAMPLE_FILE_NAME)).exists())); } @Test public void deleteOldUnusedFilesNotDeletingFilesCreatedOrModifiedInTheLastFifteenMinutes() throws FileNotFoundException, UnsupportedEncodingException { PrintWriter writer = new PrintWriter(SAMPLE_FILE_NAME, FILE_FORMAT); writer.close(); gameScheduleService.deleteOldUnusedFiles(); assertTrue((new File(String.format("./%s", SAMPLE_FILE_NAME)).exists())); // CLEANUP File file = new File(ROOT_DIRECTORY + SAMPLE_FILE_NAME); boolean cleanupSuccess = file.delete(); assertTrue(cleanupSuccess); } }
37.933824
134
0.741035
3334965719b021bbd03119042e95c8563a0cdb7e
9,233
py
Python
tests.py
jpchiodini/Grasp-Planning
e31234244b8f934743605ebea59d9d98a258957e
[ "MIT" ]
null
null
null
tests.py
jpchiodini/Grasp-Planning
e31234244b8f934743605ebea59d9d98a258957e
[ "MIT" ]
null
null
null
tests.py
jpchiodini/Grasp-Planning
e31234244b8f934743605ebea59d9d98a258957e
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ tests.py ======== Created by: hbldh <henrik.blidh@nedomkull.com> Created on: 2016-02-07, 23:50 """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import import numpy as np import pyefd lbl_1 = 5 img_1 = np.array( [[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 191, 64, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 64, 0, 0, 0, 0, 64, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 0, 64, 127, 64, 64, 0, 0, 64, 191, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 64, 0, 0, 127, 255, 255, 191, 64, 0, 0, 0, 0, 0, 64, 127, 127, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 191, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 191, 0, 0, 0, 64, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 64, 0, 0, 0, 0, 0, 64, 191, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 64, 0, 0, 0, 0, 64, 191, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 191, 127, 0, 0, 0, 0, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 191, 127, 0, 0, 0, 64, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 191, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 0, 127, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 0, 127, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 191, 255, 255, 255, 255, 127, 0, 0, 0, 191, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 127, 255, 255, 191, 64, 0, 0, 0, 191, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 64, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 0, 0, 64, 191, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]]) contour_1 = np.array([[24.0, 13.0125], [23.0125, 14.0], [23.004188481675392, 15.0], [23.0, 15.0125], [22.0125, 16.0], [22.00313725490196, 17.0], [22.0, 17.004188481675392], [21.0, 17.004188481675392], [20.004188481675392, 18.0], [20.0, 18.004188481675392], [19.0, 18.006299212598424], [18.0, 18.006299212598424], [17.0, 18.004188481675392], [16.9875, 18.0], [16.0, 17.0125], [15.993700787401576, 17.0], [15.0, 16.006299212598424], [14.995811518324608, 16.0], [14.9875, 15.0], [14.0, 14.0125], [13.995811518324608, 14.0], [13.9875, 13.0], [13.0, 12.0125], [12.996862745098039, 12.0], [12.993700787401576, 11.0], [12.9875, 10.0], [12.0, 9.0125], [11.0, 9.003137254901961], [10.0, 9.006299212598424], [9.006299212598424, 10.0], [9.003137254901961, 11.0], [9.003137254901961, 12.0], [9.004188481675392, 13.0], [9.0125, 14.0], [10.0, 14.9875], [10.003137254901961, 15.0], [10.003137254901961, 16.0], [10.003137254901961, 17.0], [10.003137254901961, 18.0], [10.003137254901961, 19.0], [10.0, 19.0125], [9.0125, 20.0], [9.006299212598424, 21.0], [9.006299212598424, 22.0], [9.0, 22.006299212598424], [8.9875, 22.0], [8.0, 21.0125], [7.996862745098039, 21.0], [7.996862745098039, 20.0], [8.0, 19.9875], [8.9875, 19.0], [8.9875, 18.0], [8.993700787401576, 17.0], [8.9875, 16.0], [8.0, 15.0125], [7.996862745098039, 15.0], [7.9875, 14.0], [7.0, 13.0125], [6.993700787401575, 13.0], [6.0, 12.006299212598424], [5.993700787401575, 12.0], [5.9875, 11.0], [5.995811518324607, 10.0], [6.0, 9.996862745098039], [7.0, 9.9875], [7.9875, 9.0], [8.0, 8.995811518324608], [8.995811518324608, 8.0], [9.0, 7.995811518324607], [10.0, 7.9875], [10.9875, 7.0], [11.0, 6.995811518324607], [12.0, 6.995811518324607], [12.0125, 7.0], [13.0, 7.9875], [13.003137254901961, 8.0], [13.006299212598424, 9.0], [13.0125, 10.0], [14.0, 10.9875], [14.004188481675392, 11.0], [14.006299212598424, 12.0], [15.0, 12.993700787401576], [15.004188481675392, 13.0], [15.006299212598424, 14.0], [16.0, 14.993700787401576], [16.00313725490196, 15.0], [17.0, 15.996862745098039], [17.006299212598424, 16.0], [18.0, 16.993700787401576], [19.0, 16.993700787401576], [19.993700787401576, 16.0], [20.0, 15.993700787401576], [20.993700787401576, 15.0], [21.0, 14.9875], [21.9875, 14.0], [21.995811518324608, 13.0], [21.99686274509804, 12.0], [21.99686274509804, 11.0], [21.993700787401576, 10.0], [21.0, 9.006299212598424], [20.993700787401576, 9.0], [21.0, 8.993700787401576], [22.0, 8.996862745098039], [22.006299212598424, 9.0], [23.0, 9.993700787401576], [23.006299212598424, 10.0], [24.0, 10.993700787401576], [24.00313725490196, 11.0], [24.00313725490196, 12.0], [24.00313725490196, 13.0], [24.0, 13.0125]]) def test_efd_shape_1(): coeffs = pyefd.elliptic_fourier_descriptors(contour_1, order=10) assert coeffs.shape == (10, 4) def test_efd_shape_2(): c = pyefd.elliptic_fourier_descriptors(contour_1, order=40) assert c.shape == (40, 4) def test_normalizing_1(): c = pyefd.elliptic_fourier_descriptors(contour_1, normalize=False) assert np.abs(c[0, 0]) > 0.0 assert np.abs(c[0, 1]) > 0.0 assert np.abs(c[0, 2]) > 0.0 def test_normalizing_2(): c = pyefd.elliptic_fourier_descriptors(contour_1, normalize=True) np.testing.assert_almost_equal(c[0, 0], 1.0, decimal=14) np.testing.assert_almost_equal(c[0, 1], 0.0, decimal=14) np.testing.assert_almost_equal(c[0, 2], 0.0, decimal=14) def test_locus(): locus = pyefd.calculate_dc_coefficients(contour_1) np.testing.assert_array_almost_equal(locus, np.mean(contour_1, axis=0), decimal=0) def test_fit_1(): n = 300 locus = pyefd.calculate_dc_coefficients(contour_1) coeffs = pyefd.elliptic_fourier_descriptors(contour_1, order=20) t = np.linspace(0, 1.0, n) xt = np.ones((n,)) * locus[0] yt = np.ones((n,)) * locus[1] for n in pyefd._range(coeffs.shape[0]): xt += (coeffs[n, 0] * np.cos(2 * (n + 1) * np.pi * t)) + \ (coeffs[n, 1] * np.sin(2 * (n + 1) * np.pi * t)) yt += (coeffs[n, 2] * np.cos(2 * (n + 1) * np.pi * t)) + \ (coeffs[n, 3] * np.sin(2 * (n + 1) * np.pi * t)) assert True
58.069182
120
0.552475
991db8fb2069a61c9b839a0e557994476e23fad7
46
swift
Swift
MyPodTest/Classes/ReplaceMe.swift
lparana/MyPodTest
03c02a5c830b7a16ade6ac35be3dd2b5adad5d2e
[ "MIT" ]
null
null
null
MyPodTest/Classes/ReplaceMe.swift
lparana/MyPodTest
03c02a5c830b7a16ade6ac35be3dd2b5adad5d2e
[ "MIT" ]
null
null
null
MyPodTest/Classes/ReplaceMe.swift
lparana/MyPodTest
03c02a5c830b7a16ade6ac35be3dd2b5adad5d2e
[ "MIT" ]
null
null
null
//Hacemos changes para probar la version 1.0
15.333333
44
0.76087
2657d5a31cdf47a3396963fbbab2c77e82495953
8,207
java
Java
library/src/main/java/com/miu30/common/config/Config.java
mc190diancom/taxi_inspect
8e07e03006f520c1f33a6c5cad59e14e5eae34dd
[ "Apache-2.0" ]
null
null
null
library/src/main/java/com/miu30/common/config/Config.java
mc190diancom/taxi_inspect
8e07e03006f520c1f33a6c5cad59e14e5eae34dd
[ "Apache-2.0" ]
null
null
null
library/src/main/java/com/miu30/common/config/Config.java
mc190diancom/taxi_inspect
8e07e03006f520c1f33a6c5cad59e14e5eae34dd
[ "Apache-2.0" ]
null
null
null
package com.miu30.common.config; import android.os.Environment; import com.miu30.common.MiuBaseApp; import com.miu360.library.BuildConfig; /** * Created by Murphy on 2018/10/8. */ public class Config { public final static String DIR_PATH = Environment.getExternalStorageDirectory().getPath() + "/jicha/"; public final static String PATH = Environment.getExternalStorageDirectory().getPath() + "/qh_inspect/"; public final static String PATHROOT = Environment.getExternalStorageDirectory().getAbsolutePath(); public final static String FILE_NAME = "inspector.txt"; public final static String CASE_TEMP = "case.txt"; public final static String CASE_TEMPS = "cases.txt"; public final static String FILE_NAME2 = "temp.txt"; public final static String ID_FILE_NAME = "cardqr.txt"; public static final String IP = BuildConfig.IP; public static final String SERVER_BASIC = "http://" + IP + BuildConfig.PORT; public static final String SERVER = SERVER_BASIC + "requestApi"; public static final String SERVER_POSITION = SERVER + "/common"; public static final String SERVER_SAVEINFO = SERVER + "/bs_Taxi"; public static final String SERVER_ZFRY = SERVER + "/zfry"; public static final String SERVER_OTHER = SERVER + "/other"; public static final String SERVER_WAIQIN = SERVER + "/wqxcjcbl"; public static final String SERVER_BLLIST = SERVER + "/bllist"; public static final String SERVER_WEBSERVICE = SERVER + "/webservice"; public static final String SERVER_DOWNLOAD = SERVER + "/transfers"; public static final String SERVER_VIDEO = SERVER + "/video"; public static final String SERVER_TAXIINFO = SERVER + "/app_Taxi"; public static final String SERVER_SIGN = SERVER + "/sign"; public static final String SERVER_BJCRSIGN = "http://" + IP + ":9878/" + "AnyWriteClientToolTest/anyWriteSignPDF"; public static final String SERVER_ZFRYSIGN = "http://" + IP + ":9878/" + "MssgPdfClientTest/asyncSignAddJob"; public static final String SERVER_PDFSIGN = "http://" + IP + ":9878/" + "ESSPDFClientToolTest/pdfsign"; public final static String path_root = PATHROOT + "/Android/data/" + MiuBaseApp.self.getPackageName() + "/files/"; public static final int LAWLOCATION = 1; //缓存KEY public static final String CASEKEY = "case";//案件 public static final String UTCKEY = "utc";//时间 public static final String LIVER = "live";//现场检查笔录 public static final String PARK = "park";//停车场 public static final String TIME = "time";//扣车时间 public static final String CAR = "car";//车辆信息 public static final String DRIVER = "driver";//被检查人信息 public static final String JCX = "jcx";//检查项信息 public static final String LAWTOC = "lawToC";//现场检查笔录需要用到的执法稽查信息 public static final String JDKH = "jdkh";//监督卡号 public static final String SFZH = "sfzh";//身份证号 public static final String DISTRICT = "district";//区域 public static final String ILLEGALDETAIL = "illegalDetail";//违法行为 public static final String AGENCYINFOS = "agencyInfos";//机关信息 public static final String PARKS = "parks";//停车场 public static final String AGENCYINFOBYZFZH = "agencyOfZFZH";//执法账号机关信息 public static final int SERVICE_PRINT = 1; public static final int SERVICE_CAR = 2; public static final int SERVICE_SFZH = 3; public static final String CHOOSE_TYPE_KEY = "choose_type"; public static final String PRINT_TIMES = "print_times";//打印次数 //eventbus发送code public static final String SELECTADD = "HandLocation";//手动定位 public static final String ILLEGAL = "Illegal";//违法行为 public static final String UPDATECASE = "UpdateCase";//更新了案件信息过后,返回对应文书操作 public static final String UPDATECASESTATUS = "UpdateCaseStatus";//修改通用数据或者文书时间后,后续文书状态改变 public static final int RESULT_SUCCESS = 0; public static final int RESULT_EMPTY = 1; public static final int RESULT_ERROR = 2; //约定的每个文书最小时长 public static final long UTC_LIVERECORD = 11 * 60;//北京市交通执法总队现场检查笔录(路检) public static final long UTC_TALKNOTICE = 6 * 60;//北京市交通执法总队谈话通知书 public static final long UTC_FRISTREGISTER = 8 * 60;//北京市交通执法总队证据先行登记保存通知书 public static final long UTC_CARDECIDE = 8 * 60;//北京市交通执法总队扣押车辆决定书 public static final long UTC_LIVETRANSCRIPT = 6 * 60;//北京市交通执法总队现场笔录 public static final long UTC_ADMINISTRATIVE = 10 * 60;//北京市交通执法总队当场行政处罚决定书(警告) public static final long UTC_CARFORM = 5 * 60;//北京市交通执法总队执法暂扣车辆交接单 public static final long UTC_ZPDZ = 3 * 60;//北京市交通执法总队现场拍照 //与服务端约定的文书type;文书1.0用到(这个是用的表名;为什么有两个) public static final String T_LIVERECORD = "T_BJSJTZFZD_XCJCBL";//北京市交通执法总队现场检查笔录(路检) public static final String T_TALKNOTICE = "T_BJSJTZFZD_THTZS";//北京市交通执法总队谈话通知书 public static final String T_FRISTREGISTER = "T_BJSJTZFZD_ZJXXDJ_BCTZS";//北京市交通执法总队证据先行登记保存通知书 public static final String T_CARDECIDE = "T_BJSJTZFZD_KYCLJDS";//北京市交通执法总队扣押车辆决定书 public static final String T_LIVETRANSCRIPT = "T_BJSJTZFZD_XCBL";//北京市交通执法总队现场笔录 public static final String T_ADMINISTRATIVE = "T_BJSJTZFZD_DCXZCFJDS";//北京市交通执法总队当场行政处罚决定书(警告) public static final String T_CARFORM = "T_BJSJTZFZD_ZFZKCLJJD";//北京市交通执法总队执法暂扣车辆交接单 public static final String T_ZPDZ = "T_BJSJTZFZD_ZPDZ";//北京市交通执法总队现场拍照 //与服务端约定的文书type;文书1.0用到 public static final String LIVERECORD = "XCJCBL1";//北京市交通执法总队现场检查笔录(路检) public static final String TALKNOTICE = "THTZS";//北京市交通执法总队谈话通知书 public static final String FRISTREGISTER = "BSCTZS";//北京市交通执法总队证据先行登记保存通知书 public static final String CARDECIDE = "KYCLJDS";//北京市交通执法总队扣押车辆决定书 public static final String LIVETRANSCRIPT = "XCBL";//北京市交通执法总队现场笔录 public static final String ADMINISTRATIVE = "DCXZCFJDS";//北京市交通执法总队当场行政处罚决定书(警告) public static final String CARFORM = "CLJJD";//北京市交通执法总队执法暂扣车辆交接单 public static final String ZPDZ = "ZPDZ";//北京市交通执法总队现场拍照 //与服务端约定的文书type;文书1.0用到 public static final String ID_LIVERECORD = "d6b562595aa04fb6b1d91e288c0f5846";//北京市交通执法总队现场检查笔录(路检) public static final String ID_TALKNOTICE = "e22671de33bd4e20a8f346f53d2ac44f";//北京市交通执法总队谈话通知书 public static final String ID_FRISTREGISTER = "612bd85d96af4cebb264f265d2220e7e";//北京市交通执法总队证据先行登记保存通知书 public static final String ID_CARDECIDE = "16e82e98ef4c4f7e90b08151d20f6f52";//北京市交通执法总队扣押车辆决定书 public static final String ID_LIVETRANSCRIPT = "e6b230fb5c094aa2a0babc1aaa1eeed7";//北京市交通执法总队现场笔录 public static final String ID_ADMINISTRATIVE = "575fd68709f246a6b0c068d254a75a04";//北京市交通执法总队当场行政处罚决定书(警告) public static final String ID_CARFORM = "a51d884d058344889bd7275b09fbab24";//北京市交通执法总队执法暂扣车辆交接单 public static final String ID_ZPDZ = "5830a5fb061f40159e866e1124093b3c";//北京市交通执法总队现场拍照 //与服务端约定的文书type;文书1.0用到 public static final String STR_LIVERECORD = "现场检查笔录(路检)";//北京市交通执法总队现场检查笔录(路检) public static final String STR_TALKNOTICE = "谈话通知书";//北京市交通执法总队谈话通知书 public static final String STR_FRISTREGISTER = "先行登记通知书";//北京市交通执法总队证据先行登记保存通知书 public static final String STR_CARDECIDE = "扣押车辆决定书";//北京市交通执法总队扣押车辆决定书 public static final String STR_LIVETRANSCRIPT = "现场笔录";//北京市交通执法总队现场笔录 public static final String STR_ADMINISTRATIVE = "行政处罚决定书";//北京市交通执法总队当场行政处罚决定书(警告) public static final String STR_CARFORM = "扣押车辆交接单";//北京市交通执法总队执法暂扣车辆交接单 public static final String STR_ZPDZ = "询问笔录";//北京市交通执法总队现场拍照 //文书2.0用到 public static final String ZLGZTZS = "ZLGZTZS";//北京市交通执法总队责令(限期)改正通知书 public static final String XCJCBL2 = "XCJCBL2";//北京市交通执法总队现场检查笔录 public static final String XWBL_HXY1 = "XWBL_HXY1";//北京市交通执法总队询问笔录1(黑巡游) public static final String XWBL_HWY1 = "XWBL_HWY1";//北京市交通执法总队询问笔录1(黑网约) public static final String XWBL1 = "XWBL1";//北京市交通执法总队询问笔录1 public static final String XWBL_HXY2 = "XWBL_HXY2";//北京市交通执法总队询问笔录2(黑巡游) public static final String XWBL_HXY3 = "XWBL_HXY3";//北京市交通执法总队询问笔录3(黑巡游) public static final String XWBL_HWY2 = "XWBL_HWY2";//北京市交通执法总队询问笔录2(黑网约) public static final String XWBL_HWY3 = "XWBL_HWY3";//北京市交通执法总队询问笔录3(黑网约) public static final String XWBL2 = "XWBL2";//北京市交通执法总队询问笔录2 public static final String XWBL3 = "XWBL3";//北京市交通执法总队询问笔录3 }
56.6
118
0.74802
26b8731267938448accd264efb8d1a0de5861603
8,871
java
Java
src/main/java/org/geoscript/js/filter/Filter.java
geoscript/geoscript-js
f05f29ed074c6c4dd1e840f47b4a03d1d6569b93
[ "MIT" ]
37
2015-01-12T06:40:07.000Z
2021-04-21T03:45:03.000Z
src/main/java/org/geoscript/js/filter/Filter.java
geoscript/geoscript-js
f05f29ed074c6c4dd1e840f47b4a03d1d6569b93
[ "MIT" ]
17
2015-02-11T04:28:00.000Z
2020-08-06T23:18:54.000Z
src/main/java/org/geoscript/js/filter/Filter.java
geoscript/geoscript-js
f05f29ed074c6c4dd1e840f47b4a03d1d6569b93
[ "MIT" ]
12
2015-01-14T01:40:19.000Z
2021-03-27T22:16:44.000Z
package org.geoscript.js.filter; import org.geoscript.js.GeoObject; import org.geoscript.js.feature.Feature; import org.geotools.factory.CommonFactoryFinder; import org.geotools.util.factory.GeoTools; import org.geotools.filter.text.cql2.CQL; import org.geotools.filter.text.cql2.CQLException; import org.geotools.filter.text.ecql.ECQL; import org.geotools.xsd.Encoder; import org.mozilla.javascript.*; import org.mozilla.javascript.annotations.JSConstructor; import org.mozilla.javascript.annotations.JSFunction; import org.mozilla.javascript.annotations.JSGetter; import org.mozilla.javascript.annotations.JSStaticFunction; import org.opengis.filter.FilterFactory2; import org.opengis.filter.identity.FeatureId; import javax.xml.namespace.QName; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Filter extends GeoObject implements Wrapper { /** * serialVersionUID */ private static final long serialVersionUID = 4426338466323185386L; private org.opengis.filter.Filter filter; private static FilterFactory2 factory = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()); /** * The Prototype constructor */ public Filter() { } public Filter(org.opengis.filter.Filter filter) { this.filter = filter; } public Filter(Scriptable scope, org.opengis.filter.Filter filter) { this(filter); this.setParentScope(scope); this.setPrototype(Module.getClassPrototype(Filter.class)); } public Filter(String cql) { this(fromCQL(cql)); } public Filter(Scriptable scope, String cql) { this(scope, fromCQL(cql)); } /** * Create a GeoTools Filter from a CQL String */ private static org.opengis.filter.Filter fromCQL(String cql) { org.opengis.filter.Filter filter; try { filter = ECQL.toFilter(cql); } catch (CQLException ex1) { try { filter = CQL.toFilter(cql); } catch (CQLException ex2) { throw ScriptRuntime.constructError("Error", "Can't parse Filter CQL Expression: " + ex2.getMessage() + " or ECQL Expression: " + ex1.getMessage()); } } return filter; } @JSConstructor public static Object constructor(Context cx, Object[] args, Function ctorObj, boolean isNewExpr) { if (args.length != 1) { return new Filter(); } Filter filter; Object arg = args[0]; String cql; if (arg instanceof String) { cql = (String) arg; } else if (arg instanceof NativeObject) { NativeObject config = (NativeObject) arg; cql = config.get("cql", config).toString(); } else if (arg instanceof Filter) { cql = ((Filter) arg).getCql(); } else { throw ScriptRuntime.constructError("Error", "Cannot create filter from provided value: " + Context.toString(ctorObj)); } if (isNewExpr) { filter = new Filter(cql); } else { filter = new Filter(ctorObj.getParentScope(), cql); } return filter; } @JSFunction public boolean evaluate(Feature feature) { return filter.evaluate(feature.unwrap()); } @JSGetter public Filter getNot() { return new Filter(factory.not(this.filter)); } @JSFunction public Filter and(Scriptable filters) { if (filters instanceof NativeArray) { NativeArray array = (NativeArray) filters; array.add(this.filter); return Filter.staticAnd(array); } else { org.opengis.filter.Filter filter = factory.and(this.filter, ((Filter) filters).unwrap()); return new Filter(getTopLevelScope(filters), filter); } } @JSFunction public Filter or(Scriptable filters) { if (filters instanceof NativeArray) { NativeArray array = (NativeArray) filters; array.add(this.filter); return Filter.staticOr(array); } else { org.opengis.filter.Filter filter = factory.or(this.filter, ((Filter) filters).unwrap()); return new Filter(getTopLevelScope(filters), filter); } } @JSGetter public String getCql() { return ECQL.toCQL(this.filter); } @JSGetter("_filter") public org.opengis.filter.Filter getFilter() { return this.filter; } @JSGetter @Override public Scriptable getConfig() { Scriptable obj = super.getConfig(); obj.put("type", obj, "Filter"); obj.put("text", obj, getCql()); return obj; } @JSFunction public String toXML(String version, boolean pretty) throws IOException { org.geotools.xsd.Encoder encoder; QName qname; if (version.equalsIgnoreCase("1.1")) { qname = org.geotools.filter.v1_1.OGC.getInstance().Filter; org.geotools.filter.v1_1.OGCConfiguration config = new org.geotools.filter.v1_1.OGCConfiguration(); encoder = new Encoder(config); } else { qname = org.geotools.filter.v1_0.OGC.getInstance().Filter; org.geotools.filter.v1_0.OGCConfiguration config = new org.geotools.filter.v1_0.OGCConfiguration(); encoder = new Encoder(config); } encoder.setIndenting(pretty); encoder.setOmitXMLDeclaration(true); ByteArrayOutputStream out = new ByteArrayOutputStream(); encoder.encode(this.filter, qname, out); return new String(out.toByteArray()); } @Override public String toFullString() { return getCql(); } @Override public org.opengis.filter.Filter unwrap() { return filter; } @Override public String getClassName() { return getClass().getName(); } private static List<org.opengis.filter.Filter> getFilters(NativeArray array) { List<org.opengis.filter.Filter> filters = new ArrayList<>(); for (int i = 0; i < array.size(); i++) { Object item = array.get(i); Filter filter; if (item instanceof Filter) { filter = (Filter) item; } else if (item instanceof org.opengis.filter.Filter) { filter = new Filter(getTopLevelScope(array), (org.opengis.filter.Filter) item); } else { filter = new Filter(getTopLevelScope(array), array.get(i).toString()); } filters.add(filter.unwrap()); } return filters; } @JSStaticFunction("from_") public static Filter from(Scriptable filterObject) { org.opengis.filter.Filter filter = null; if (filterObject instanceof Wrapper) { Object obj = ((Wrapper) filterObject).unwrap(); if (obj instanceof org.opengis.filter.Filter) { filter = (org.opengis.filter.Filter) obj; } } if (filter == null) { throw ScriptRuntime.constructError("Error", "Cannot create filter from " + Context.toString(filterObject)); } return new Filter(getTopLevelScope(filterObject), filter); } @JSStaticFunction("and") public static Filter staticAnd(NativeArray array) { List<org.opengis.filter.Filter> filters = getFilters(array); return new Filter(getTopLevelScope(array), factory.and(filters)); } @JSStaticFunction("or") public static Filter staticOr(NativeArray array) { List<org.opengis.filter.Filter> filters = getFilters(array); return new Filter(getTopLevelScope(array), factory.or(filters)); } @JSStaticFunction("not") public static Filter staticNot(Scriptable obj) { Filter filter; String cql; if (obj instanceof NativeObject) { NativeObject config = (NativeObject) obj; cql = config.get("cql", config).toString(); } else if (obj.getDefaultValue(null) instanceof String) { cql = obj.getDefaultValue(null).toString(); } else { throw ScriptRuntime.constructError("Error", "Cannot create filter from provided value: " + Context.toString(obj)); } filter = new Filter(cql); return new Filter(getTopLevelScope(obj), factory.not(filter.unwrap())); } @JSStaticFunction public static Filter fids(NativeArray array) { Set<FeatureId> featureIds = new HashSet<FeatureId>(); for (int i = 0; i < array.size(); i++) { featureIds.add(factory.featureId(array.get(i).toString())); } return new Filter(getTopLevelScope(array), factory.id(featureIds)); } }
33.602273
130
0.625183
3dbbd19191e48ecd9f1740a330c6175eca70e428
1,529
swift
Swift
Pods/Reductio/Source/Keyword.swift
danielsogl/DHBW-Sentiment-Analyse-App
05bd4208530b453594398938ffca9d1402a8d031
[ "MIT" ]
456
2016-03-10T00:50:57.000Z
2022-03-14T22:03:44.000Z
Pods/Reductio/Source/Keyword.swift
danielsogl/DHBW-Sentiment-Analyse-App
05bd4208530b453594398938ffca9d1402a8d031
[ "MIT" ]
8
2016-07-07T12:53:15.000Z
2020-11-15T15:10:18.000Z
Pods/Reductio/Source/Keyword.swift
danielsogl/DHBW-Sentiment-Analyse-App
05bd4208530b453594398938ffca9d1402a8d031
[ "MIT" ]
39
2016-04-29T01:35:17.000Z
2022-01-05T05:58:24.000Z
/** This file is part of the Reductio package. (c) Sergio Fernández <fdz.sergio@gmail.com> For the full copyright and license information, please view the LICENSE file that was distributed with this source code. */ import Foundation internal final class Keyword { private let ngram: Int = 3 private var words: [String] private let ranking = TextRank<String>() init(text: String) { self.words = Keyword.preprocess(text) } func execute() -> [String] { filterWords() buildGraph() return ranking.execute() .sorted { $0.1 > $1.1 } .map { $0.0 } } func filterWords() { self.words = self.words .filter(removeShortWords) .filter(removeStopWords) } func buildGraph() { for (index, node) in words.enumerated() { var (min, max) = (index-ngram, index+ngram) if min < 0 { min = words.startIndex } if max > words.count { max = words.endIndex } words[min..<max].forEach { word in ranking.add(edge: node, to: word) } } } } private extension Keyword { static func preprocess(_ text: String) -> [String] { return text.lowercased() .components(separatedBy: CharacterSet.letters.inverted) } func removeShortWords(_ word: String) -> Bool { return word.count > 2 } func removeStopWords(_ word: String) -> Bool { return !stopwords.contains(word) } }
24.269841
72
0.580118
2a49d10de87853f41d099eca38360dc7f17f0cd3
39
java
Java
src/test/java/api/TestAPI.java
annashevchenko/TrelloEdu
94ef2de1869663eb9e0a498f00079c536d9a013c
[ "Apache-2.0" ]
null
null
null
src/test/java/api/TestAPI.java
annashevchenko/TrelloEdu
94ef2de1869663eb9e0a498f00079c536d9a013c
[ "Apache-2.0" ]
null
null
null
src/test/java/api/TestAPI.java
annashevchenko/TrelloEdu
94ef2de1869663eb9e0a498f00079c536d9a013c
[ "Apache-2.0" ]
null
null
null
package api; public class TestAPI { }
7.8
22
0.717949
f06b7dacabf643f015d3254946fb072f70df1f52
2,170
js
JavaScript
src/components/Navigation/index.js
shivamkejriwal/blackbearfinance
dc4817adad25eddc7a964186d343c7bb29f8f932
[ "MIT" ]
null
null
null
src/components/Navigation/index.js
shivamkejriwal/blackbearfinance
dc4817adad25eddc7a964186d343c7bb29f8f932
[ "MIT" ]
2
2021-05-11T11:35:28.000Z
2022-01-22T11:44:54.000Z
src/components/Navigation/index.js
shivamkejriwal/blackbearfinance
dc4817adad25eddc7a964186d343c7bb29f8f932
[ "MIT" ]
null
null
null
import React from 'react'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography'; import IconButton from '@material-ui/core/IconButton'; import MenuIcon from '@material-ui/icons/Menu'; import Drawer from '@material-ui/core/Drawer'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import Divider from '@material-ui/core/Divider'; import { AuthUserContext } from '../Authentication/Session'; import { StyledIconButton } from './StyledComponents'; import useStyles from './useStyles'; import SidebarList from './routeList'; import AuthButton from './authButton'; const Navigation = () => ( <AuthUserContext.Consumer> {authUser => ( <ApplicationBar authUser={authUser} /> ) } </AuthUserContext.Consumer> ); const ApplicationBar = ({ authUser }) => { const classes = useStyles(); const [open, setOpen] = React.useState(false); const handleDrawerOpen = () => setOpen(true); const handleDrawerClose = () => setOpen(false); return ( <div className={classes.root}> <AppBar position='static' className={classes.colorPrimary} > <Toolbar> <IconButton edge='start' className={classes.menuButton} color='inherit' aria-label='menu' onClick={handleDrawerOpen}> <MenuIcon /> </IconButton> <Typography variant='h6' className={classes.title}> Black Bear Finance </Typography> <AuthButton authUser={authUser} /> </Toolbar> </AppBar> <Drawer open={open} onClose={handleDrawerClose} classes={{paper: classes.paper}}> <div> <StyledIconButton onClick={handleDrawerClose}> <ChevronLeftIcon /> </StyledIconButton> </div> <Divider /> <SidebarList /> </Drawer> </div> ); }; export default Navigation;
32.878788
63
0.578802
9dd5df6c28de014877f781fc6a6d8e80b3425585
129
kt
Kotlin
app/src/main/java/com/kylecorry/trail_sense/navigation/paths/domain/PathSimplificationQuality.kt
kylecorry31/Survive
17bb2fc2efaa8e9041618356e4bcce3583d34866
[ "MIT" ]
2
2021-04-17T17:34:20.000Z
2021-04-17T17:34:23.000Z
app/src/main/java/com/kylecorry/trail_sense/navigation/paths/domain/PathSimplificationQuality.kt
qwerty287/Trail-Sense
52f0335d4bbcbf08243be05b955e6d13ec6ca881
[ "MIT" ]
19
2019-12-23T16:23:52.000Z
2019-12-29T01:14:19.000Z
app/src/main/java/com/kylecorry/trail_sense/navigation/paths/domain/PathSimplificationQuality.kt
qwerty287/Trail-Sense
52f0335d4bbcbf08243be05b955e6d13ec6ca881
[ "MIT" ]
null
null
null
package com.kylecorry.trail_sense.navigation.paths.domain enum class PathSimplificationQuality { Low, Medium, High }
18.428571
57
0.75969
5f9928ce12f874a31d67ec4ef79a9fa6acb9179a
249
h
C
Lesson31/SwiftObjective/ObjcLibrarySecond/ObjcLibrarySecond.h
zardak12/SberSchoolprojects
f2614e4072f85e6f815fa454fb6fd177b990f259
[ "MIT" ]
null
null
null
Lesson31/SwiftObjective/ObjcLibrarySecond/ObjcLibrarySecond.h
zardak12/SberSchoolprojects
f2614e4072f85e6f815fa454fb6fd177b990f259
[ "MIT" ]
null
null
null
Lesson31/SwiftObjective/ObjcLibrarySecond/ObjcLibrarySecond.h
zardak12/SberSchoolprojects
f2614e4072f85e6f815fa454fb6fd177b990f259
[ "MIT" ]
1
2021-05-20T09:13:51.000Z
2021-05-20T09:13:51.000Z
// // ObjcLibrarySecond.h // ObjcLibrarySecond // // Created by Марк Шнейдерман on 11.07.2021. // #import <Foundation/Foundation.h> @interface ObjcLibrarySecond : NSObject @property (strong, nonatomic, readonly) NSString *secondString; @end
15.5625
63
0.73494
f02f263b4792b69303bcdec39c484284dc805802
1,221
py
Python
src/prefect/engine/result_handlers/secret_result_handler.py
trapped/prefect
128f11570c35e7156d65ba65fdcbc1f4ccd7c2b7
[ "Apache-2.0" ]
1
2019-12-20T07:43:55.000Z
2019-12-20T07:43:55.000Z
src/prefect/engine/result_handlers/secret_result_handler.py
trapped/prefect
128f11570c35e7156d65ba65fdcbc1f4ccd7c2b7
[ "Apache-2.0" ]
null
null
null
src/prefect/engine/result_handlers/secret_result_handler.py
trapped/prefect
128f11570c35e7156d65ba65fdcbc1f4ccd7c2b7
[ "Apache-2.0" ]
null
null
null
import json from typing import Any import prefect from prefect.engine.result_handlers import ResultHandler class SecretResultHandler(ResultHandler): """ Hook for storing and retrieving sensitive task results from a Secret store. Only intended to be used for Secret tasks. Args: - secret_task (Task): the Secret Task that this result handler will be used for """ def __init__(self, secret_task: "prefect.tasks.secrets.Secret") -> None: self.secret_task = secret_task super().__init__() def read(self, name: str) -> Any: """ Read a secret from a provided name with the provided Secret class; this method actually retrieves the secret from the Secret store. Args: - name (str): the name of the secret to retrieve Returns: - Any: the deserialized result """ return self.secret_task.run() # type: ignore def write(self, result: Any) -> str: """ Returns the name of the secret. Args: - result (Any): the result to write Returns: - str: the JSON representation of the result """ return self.secret_task.name
27.133333
104
0.626536
9a69220b3c6ddb2ca5b4f27ebc618644640280ca
4,122
css
CSS
src/sap.ui.demokit/src/sap/ui/demokit/explored/css/titles.css
xefimx/openui5
0243bba136ad14ad63a438f51d95faeee92f4e65
[ "Apache-2.0" ]
1
2022-02-02T01:39:20.000Z
2022-02-02T01:39:20.000Z
src/sap.ui.demokit/src/sap/ui/demokit/explored/css/titles.css
Etignis/openui5
b9ed6bd2f685e669c1fb67d33fe3b9438d674fbf
[ "Apache-2.0" ]
null
null
null
src/sap.ui.demokit/src/sap/ui/demokit/explored/css/titles.css
Etignis/openui5
b9ed6bd2f685e669c1fb67d33fe3b9438d674fbf
[ "Apache-2.0" ]
1
2022-02-02T01:39:21.000Z
2022-02-02T01:39:21.000Z
.titlesSpace { background-image: url(stars.png); width: 100%; height: 100%; } .titlesSpaceViewport { -webkit-perspective: 50rem; -webkit-perspective-origin: center 20rem; perspective: 50rem; perspective-origin: center 20rem; width: 100%; height: 37.5rem; overflow: hidden; } .titlesNotFound { position: absolute; margin: 5rem; color: rgb(74,214,236); text-align: center; font-size: 1.2rem; } .titlesIntro { margin-top: 5rem; text-align: center; opacity: 0; color: rgb(74,214,236); font-size: 1.25em; font-weight: normal; -webkit-animation: intro 6s linear 13s 1; -moz-animation: intro 6s linear 13s 1; animation: intro 6s linear 13s 1; } .titlesHeader { position: absolute; top: 0rem; left: 50%; margin-left: -2em; width: 4.0em; opacity: 0; color: #000000; font-size: 20em; text-align: center; line-height: 0.1em; letter-spacing: -0.05em; text-shadow: -2px -2px 0 #ff6, 2px -2px 0 #ff6, -2px 2px 0 #ff6, 2px 2px 0 #ff6; z-index: 1; -webkit-animation: header 7s cubic-bezier(0.000, 0.730, 0.750, 0.750) 20s 1 normal forwards; -moz-animation: header 7s cubic-bezier(0.000, 0.730, 0.750, 0.750) 20s 1 normal forwards; animation: header 7s cubic-bezier(0.000, 0.730, 0.750, 0.750) 20s 1 normal forwards; } .titlesHeader sub { margin-top: 1em; display: block; font-size: 0.4em; letter-spacing: 0; line-height: 0.8em; } .titlesHeader p { display: none; } /* text shadow and animation do not work in IE9 */ html[data-sap-ui-browser="ie9"] .titlesHeader { top: 10%; opacity: 1; color: #ff6; font-size: 6em; } html[data-sap-ui-browser="ie9"] .titlesHeader sub { margin-top: 1.2em; } html[data-sap-ui-browser="ie9"] .titlesHeader p { display: block; font-weight: normal; font-size: 0.12em; } .titlesText { position: absolute; margin:0 4em 0 4em; color: #ff6; text-align: center; font-size: 1.6em; font-weight: bold; opacity: 0; -webkit-animation: text 100s linear 11s 1 normal forwards; -moz-animation: text 100s linear 11s 1 normal forwards; animation: text 100s linear 11s 1 normal forwards; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d; } .titlesText p { text-align: justify; margin: 0.3em 0; } .titlesText p.caption { text-align: center; text-transform: uppercase; } @-webkit-keyframes intro { 0% { opacity:0; } 25% { opacity:1; } 75% { opacity:1; } 100% { opacity:0; } } @-moz-keyframes intro { 0% { opacity:0; } 25% { opacity:1; } 75% { opacity:1; } 100% { opacity:0; } } @keyframes intro { 0% { opacity:0; } 25% { opacity:1; } 75% { opacity:1; } 100% { opacity:0; } } @-webkit-keyframes header { 0% { -webkit-transform: scale(1); opacity: 1; } 100% { -webkit-transform: scale(0.0); opacity: 1; } } @-moz-keyframes header { 0% { -moz-transform: scale(1); opacity: 1; } 100% { -moz-transform: scale(0.0); opacity: 1; } } @keyframes header { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.0); opacity: 1; } } @-webkit-keyframes text { 0% { -webkit-transform: rotateX(70deg) translateZ(200px) translateY(1100px); opacity:1; } 40% { -webkit-transform: rotateX(70deg) translateZ(200px) translateY(-340px); opacity:1; } 80% { -webkit-transform: rotateX(70deg) translateZ(200px) translateY(-1780px); opacity:1; } 100% { -webkit-transform: rotateX(70deg) translateZ(200px) translateY(-2500px); opacity:0; } } @-moz-keyframes text { 0% { -moz-transform: rotateX(70deg) translateZ(200px) translateY(1100px); opacity:1; } 40% { -moz-transform: rotateX(70deg) translateZ(200px) translateY(-340px); opacity:1; } 80% { -moz-transform: rotateX(70deg) translateZ(200px) translateY(-1780px); opacity:1; } 100% { -moz-transform: rotateX(70deg) translateZ(200px) translateY(-2500px); opacity:0; } } @keyframes text { 0% { transform: rotateX(70deg) translateZ(200px) translateY(1100px); opacity:1; } 40% { transform: rotateX(70deg) translateZ(200px) translateY(-340px); opacity:1; } 80% { transform: rotateX(70deg) translateZ(200px) translateY(-1780px); opacity:1; } 100% { transform: rotateX(70deg) translateZ(200px) translateY(-2500px); opacity:0; } }
25.924528
93
0.684377
7da3bee7470703f2fcdda85011666ff9fa0daafc
1,246
html
HTML
_includes/nav.html
wojciechkorfanty/theme
418c1b4827889393125c5ff1ef87efbc75390294
[ "MIT" ]
null
null
null
_includes/nav.html
wojciechkorfanty/theme
418c1b4827889393125c5ff1ef87efbc75390294
[ "MIT" ]
1
2022-01-07T15:13:18.000Z
2022-01-07T15:13:18.000Z
_includes/nav.html
wojciechkorfanty/theme
418c1b4827889393125c5ff1ef87efbc75390294
[ "MIT" ]
6
2022-01-07T12:10:30.000Z
2022-02-09T16:12:58.000Z
<nav> <h3>Themenfelder</h3> <ul> <li><a href="/studies_de_virus.html" target="_self">Virus</a></li> <li><a href="/studies_de_immunity.html" target="_self">Immunität</a></li> <li><a href="/studies_de_treatments.html" target="_self">Vorbeugung &amp; Behandlung</a></li> <li><a href="/studies_de_vaccines.html" target="_self">Impfstoffe</a></li> <li><a href="/studies_de_interventions.html" target="_self">Nichtmedizinische Maßnahmen</a></li> </ul> <ul> <li><a href="/search/search_de.html" target="_self">Suche</div></a></li> <!-- <li><a href="/tags_de.html" target="_self">Schlüsselwortverzeichnis</a></li> --> </ul> <ul> <li><a href="/posts/2022/01/21/press-release.html" target="_self">Pressemitteilung vom 21. Januar 2022</a> <li><a href="/assets/pdf/Corona-Studies_Offener-Brief_20220405.pdf" target="_self">Offener Brief an Bundestagsabgeordnete vom 5. April 2022</a> </li> </ul> <ul> <li><a href="/index.html" target="_self">Deutsch</a></li> <li><a href="/index_en.html" target="_self">Englisch</a></li> </ul> </nav>
47.923077
153
0.571429
9c246690d35eaba648573708617530901c6e4eae
492
js
JavaScript
seeds/01-events.js
glweems/cheesecake-backend
423bf772076d0edf3867f3e60493ca8f8a5ab6bf
[ "MIT" ]
null
null
null
seeds/01-events.js
glweems/cheesecake-backend
423bf772076d0edf3867f3e60493ca8f8a5ab6bf
[ "MIT" ]
3
2020-06-11T11:38:17.000Z
2021-09-01T19:17:58.000Z
seeds/01-events.js
glweems/cheesecake-backend
423bf772076d0edf3867f3e60493ca8f8a5ab6bf
[ "MIT" ]
null
null
null
exports.seed = knex => knex('events') .del() .then(() => knex('events').insert([ { title: 'Truck Round Up', date: '08/01/2019', street: 'Main street', city: 'Denton', state: 'TX', zip: 76210 }, { title: 'Denton Food Fest', date: '08/05/2019', street: 'Main street', city: 'Denton', state: 'TX', zip: 76210 } ]) );
20.5
36
0.386179
11d9b4d979963e790cde8427830d61b09ec1cfe8
905
html
HTML
blog.html
nickzuber/nickzuber-v1
200f5699fbd96bd2fbcb9979b420b2439d58a4b7
[ "MIT" ]
null
null
null
blog.html
nickzuber/nickzuber-v1
200f5699fbd96bd2fbcb9979b420b2439d58a4b7
[ "MIT" ]
null
null
null
blog.html
nickzuber/nickzuber-v1
200f5699fbd96bd2fbcb9979b420b2439d58a4b7
[ "MIT" ]
null
null
null
--- layout: page permalink: /blog/ --- <div class="home"> <ul class="post-list"> {% for post in site.posts %} <li> <a class="post-link" href="{{ post.url | prepend: site.baseurl }}"> {{ post.title }} <br /> <div class="post-meta"> {% for tag in post.tags %} <span class="post-tag tag-{{ tag }}">{{ tag }}</span> {% endfor %} <div class="post-icon-me"></div> <span itemprop="author" itemscope itemtype="http://schema.org/Person"> <span class="post-author" itemprop="name">{{ post.author }} — {{ post.date | date: "%-m/%-d/%Y" }}</span> </span> </div> {% if post.excerpt %} <span class="post-excerpt"> {{ post.excerpt }} </span> {% endif %} </a> </li> {% endfor %} </ul> </div>
26.617647
119
0.441989
d32e9bf8f9593fe95e6b8c16aa2bf159204b77ff
141
kt
Kotlin
idea/testData/codeInsight/outOfBlock/InFunInProperty.kt
kevin1e100/kotlin
1762675325c596a9742955c3862f3503cacaaf4a
[ "ECL-2.0", "Apache-2.0" ]
1
2021-02-05T11:15:45.000Z
2021-02-05T11:15:45.000Z
idea/testData/codeInsight/outOfBlock/InFunInProperty.kt
kevin1e100/kotlin
1762675325c596a9742955c3862f3503cacaaf4a
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
idea/testData/codeInsight/outOfBlock/InFunInProperty.kt
kevin1e100/kotlin
1762675325c596a9742955c3862f3503cacaaf4a
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
// OUT_OF_CODE_BLOCK: FALSE fun test() { val some = if () { fun other() { <caret> } } else { } }
12.818182
27
0.390071
1c0c623935b2f86e5daa88fa3e319596d098a539
1,857
kt
Kotlin
app/src/androidTest/java/com/ersiver/newsster/db/RemoteKeyDaoTest.kt
l2hyunwoo/Newsster
b0e11062d62e0661f4c2774df7f45309493c4b83
[ "Apache-2.0" ]
153
2020-09-09T21:42:27.000Z
2022-03-21T07:36:56.000Z
app/src/androidTest/java/com/ersiver/newsster/db/RemoteKeyDaoTest.kt
l2hyunwoo/Newsster
b0e11062d62e0661f4c2774df7f45309493c4b83
[ "Apache-2.0" ]
1
2020-09-13T20:02:00.000Z
2020-09-13T20:02:00.000Z
app/src/androidTest/java/com/ersiver/newsster/db/RemoteKeyDaoTest.kt
l2hyunwoo/Newsster
b0e11062d62e0661f4c2774df7f45309493c4b83
[ "Apache-2.0" ]
35
2020-09-13T17:51:35.000Z
2022-03-30T19:13:28.000Z
package com.ersiver.newsster.db import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.ersiver.newsster.utils.TestUtil import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runBlockingTest import org.hamcrest.CoreMatchers.notNullValue import org.hamcrest.CoreMatchers.nullValue import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.core.Is.`is` import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @ExperimentalCoroutinesApi @SmallTest @RunWith(AndroidJUnit4::class) class RemoteKeyDaoTest : LocalDatabase() { @get:Rule var instantExecutorRule = InstantTaskExecutorRule() private lateinit var remoteKeyDao: RemoteKeyDao @Before fun setup() { remoteKeyDao = database.remoteKeyDao() } @Test fun insertAndLoadById() = runBlockingTest { val article = TestUtil.createArticle() val remoteKey = TestUtil.createRemoteKey() val remoteKeys = listOf(remoteKey) remoteKeyDao.insertAll(remoteKeys) val loaded = remoteKeyDao.remoteKeyByArticle(article.id) assertThat(loaded, `is`(notNullValue())) assertThat(loaded.articleId, `is`(article.id)) assertThat(loaded.nextKey, `is`(remoteKey.nextKey)) assertThat(loaded.prevKey, `is`(remoteKey.prevKey)) } @Test fun insertAndDelete() = runBlockingTest { val article = TestUtil.createArticle() val remoteKey = TestUtil.createRemoteKey() val remoteKeys = listOf(remoteKey) remoteKeyDao.insertAll(remoteKeys) remoteKeyDao.clearRemoteKeys() val load = remoteKeyDao.remoteKeyByArticle(article.id) assertThat(load, `is`(nullValue())) } }
31.474576
66
0.739903
5b2b9232be519d3fb235474cb901a699d6c05dee
701
c
C
cpp-pthread/demo25b-atomic.c
thanhit95/multi-threading
30e745b6a6c52e56a8d8e3826ce7a97b51944caa
[ "BSD-3-Clause" ]
15
2021-06-15T09:27:35.000Z
2022-03-25T02:01:45.000Z
cpp-pthread/demo25b-atomic.c
thanhit95/multi-threads
30e745b6a6c52e56a8d8e3826ce7a97b51944caa
[ "BSD-3-Clause" ]
null
null
null
cpp-pthread/demo25b-atomic.c
thanhit95/multi-threads
30e745b6a6c52e56a8d8e3826ce7a97b51944caa
[ "BSD-3-Clause" ]
5
2021-07-15T14:31:33.000Z
2022-03-29T06:19:34.000Z
/* ATOMIC ACCESS In this demo, I use raw C language (not C++). */ #include <stdio.h> #include <pthread.h> #include <stdatomic.h> // C11 atomic #include <unistd.h> atomic_int counter; void* doTask(void* arg) { sleep(1); atomic_fetch_add(&counter, 1); pthread_exit(NULL); return NULL; } int main() { atomic_store(&counter, 0); // assign counter = 0 pthread_t lstTid[1000]; int ret = 0; for (int i = 0; i < 1000; ++i) { ret = pthread_create(&lstTid[i], NULL, doTask, NULL); } for (int i = 0; i < 1000; ++i) { ret = pthread_join(lstTid[i], NULL); } // counter = 1000 printf("counter = %d \n", counter); return 0; }
14.604167
61
0.569187
708c3e7fddba881e5e799aa7476f4a43ca370909
3,084
c
C
sdk_liteos/third_party/u-boot-v2019.07/u-boot-v2019.07/board/bosch/guardian/mux.c
openharmony-gitee-mirror/device_bearpi_bearpi_hm_nano
c463575de065aad080f730ffbd479628eb821105
[ "BSD-3-Clause" ]
1
2022-02-15T08:51:55.000Z
2022-02-15T08:51:55.000Z
sdk_liteos/third_party/u-boot-v2019.07/u-boot-v2019.07/board/bosch/guardian/mux.c
openharmony-gitee-mirror/device_bearpi_bearpi_hm_nano
c463575de065aad080f730ffbd479628eb821105
[ "BSD-3-Clause" ]
null
null
null
sdk_liteos/third_party/u-boot-v2019.07/u-boot-v2019.07/board/bosch/guardian/mux.c
openharmony-gitee-mirror/device_bearpi_bearpi_hm_nano
c463575de065aad080f730ffbd479628eb821105
[ "BSD-3-Clause" ]
1
2021-12-15T09:54:37.000Z
2021-12-15T09:54:37.000Z
// SPDX-License-Identifier: GPL-2.0+ /* * mux.c * * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ * Copyright (C) 2018 Robert Bosch Power Tools GmbH */ #include <common.h> #include <i2c.h> #include <asm/arch/hardware.h> #include <asm/arch/mux.h> #include <asm/arch/sys_proto.h> #include <asm/io.h> #include "board.h" static struct module_pin_mux uart0_pin_mux[] = { {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, {OFFSET(uart0_txd), (MODE(0) | PULLUDEN)}, {-1}, }; static struct module_pin_mux i2c0_pin_mux[] = { {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)}, {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)}, {-1}, }; static struct module_pin_mux adc_voltages_en[] = { {OFFSET(mcasp0_ahclkx), (MODE(7) | PULLUP_EN)}, {-1}, }; static struct module_pin_mux asp_power_en[] = { {OFFSET(mcasp0_aclkx), (MODE(7) | PULLUP_EN)}, {-1}, }; static struct module_pin_mux switch_off_3v6_pin_mux[] = { {OFFSET(mii1_txd0), (MODE(7) | PULLUP_EN)}, /* * The uart1 lines are made floating inputs, based on the Guardian * A2 Sample Power Supply Schematics */ {OFFSET(uart1_rxd), (MODE(7) | PULLUDDIS)}, {OFFSET(uart1_txd), (MODE(7) | PULLUDDIS)}, {-1}, }; #ifdef CONFIG_NAND static struct module_pin_mux nand_pin_mux[] = { {OFFSET(gpmc_ad0), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad1), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad2), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad3), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad4), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad5), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad6), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad7), (MODE(0) | PULLUDDIS | RXACTIVE)}, #ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT {OFFSET(gpmc_ad8), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad9), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad10), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad11), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad12), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad13), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad14), (MODE(0) | PULLUDDIS | RXACTIVE)}, {OFFSET(gpmc_ad15), (MODE(0) | PULLUDDIS | RXACTIVE)}, #endif {OFFSET(gpmc_wait0), (MODE(0) | PULLUP_EN | RXACTIVE)}, {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN)}, {OFFSET(gpmc_csn0), (MODE(0) | PULLUP_EN)}, {OFFSET(gpmc_wen), (MODE(0) | PULLDOWN_EN)}, {OFFSET(gpmc_oen_ren), (MODE(0) | PULLDOWN_EN)}, {OFFSET(gpmc_advn_ale), (MODE(0) | PULLDOWN_EN)}, {OFFSET(gpmc_be0n_cle), (MODE(0) | PULLDOWN_EN)}, {-1}, }; #endif void enable_uart0_pin_mux(void) { configure_module_pin_mux(uart0_pin_mux); } void enable_i2c0_pin_mux(void) { configure_module_pin_mux(i2c0_pin_mux); } void enable_board_pin_mux(void) { #ifdef CONFIG_NAND configure_module_pin_mux(nand_pin_mux); #endif configure_module_pin_mux(adc_voltages_en); configure_module_pin_mux(asp_power_en); configure_module_pin_mux(switch_off_3v6_pin_mux); }
30.84
75
0.673476
612b0d02b8478834ed1a34029f5eeb013bb0b3fb
1,173
css
CSS
share/kramdownStandalone/css/koyo-markdown.css
koyo922/koyo922.github.io
3c29354dd02cb508c0b8a893f490bd3144fe296d
[ "Apache-2.0" ]
2
2016-02-05T02:19:21.000Z
2016-02-05T02:45:54.000Z
share/kramdownStandalone/css/koyo-markdown.css
koyo922/koyo922.github.io
3c29354dd02cb508c0b8a893f490bd3144fe296d
[ "Apache-2.0" ]
null
null
null
share/kramdownStandalone/css/koyo-markdown.css
koyo922/koyo922.github.io
3c29354dd02cb508c0b8a893f490bd3144fe296d
[ "Apache-2.0" ]
null
null
null
*{ word-break: break-all; } em, strong { padding: 0.05em 0.2em; } em { color: darkorange; font-style: normal; font-weight: bold; } strong { color: #dd3322; background-color: #ffdff7; border-radius: 4px; } img.emoji { box-shadow: none; background-color: transparent; display: inline-block; margin: 2px; } .footnotes p { margin-bottom: 0; } .highlight > pre > code pre { color: #ddd; /* GitHub上渲染的代码结构跟本地略有不同,如果不改这里,可能看不到部分颜色的代码 */ } a.footnote { padding-left: 0.3em; color: dodgerblue; font-weight: bold; } a.footnote:before { content: "["; } a.footnote:after { content: "]"; } .note { color:brown; border-left: 12px solid #dc0; background-color: #ffa; padding: 8px; margin: 0; } .note:before { content: "注意:"; display: block; font-weight: bold; } ol.note, ul.note { padding-left: 30px; } .markdown-toc { padding-bottom: 80px; } blockquote > p:nth-last-child(n+2) { margin-bottom: 1em; } .rot90{ transform: rotate(90deg); } .rot-90{ transform: rotate(-90deg); } p { margin: 1em 0; } h1 { text-align: center; margin-bottom: 2em; } img { max-width: 100%; } dd { padding-left: 2em; } * { tab-size: 4; } ul, ol, li { margin: 0; }
12.347368
61
0.642796
26532219811d952d02125402c216d089bb477a22
3,431
java
Java
src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java
Zenika/ivy
0b2e15575b14d78806c0d848efb4ece96f22ae06
[ "Apache-2.0" ]
5
2015-08-13T14:15:54.000Z
2019-02-20T23:23:22.000Z
src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java
Zenika/ivy
0b2e15575b14d78806c0d848efb4ece96f22ae06
[ "Apache-2.0" ]
22
2015-06-25T22:09:38.000Z
2020-10-08T16:00:20.000Z
src/java/org/apache/ivy/util/extendable/UnmodifiableExtendableItem.java
Zenika/ivy
0b2e15575b14d78806c0d848efb4ece96f22ae06
[ "Apache-2.0" ]
23
2015-08-08T14:39:50.000Z
2022-03-07T12:42:40.000Z
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not 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 License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.ivy.util.extendable; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; public class UnmodifiableExtendableItem implements ExtendableItem { private final Map attributes = new HashMap(); private final Map unmodifiableAttributesView = Collections.unmodifiableMap(attributes); private final Map extraAttributes = new HashMap(); private final Map unmodifiableExtraAttributesView = Collections.unmodifiableMap(extraAttributes); /* * this is the only place where extra attributes are stored in qualified form. In all other maps * they are stored unqualified. */ private final Map qualifiedExtraAttributes = new HashMap(); private final Map unmodifiableQualifiedExtraAttributesView = Collections.unmodifiableMap(qualifiedExtraAttributes); public UnmodifiableExtendableItem(Map stdAttributes, Map extraAttributes) { if (stdAttributes != null) { this.attributes.putAll(stdAttributes); } if (extraAttributes != null) { for (Iterator iter = extraAttributes.entrySet().iterator(); iter.hasNext();) { Entry extraAtt = (Entry) iter.next(); setExtraAttribute((String) extraAtt.getKey(), (String) extraAtt.getValue()); } } } public String getAttribute(String attName) { return (String) attributes.get(attName); } public String getExtraAttribute(String attName) { String v = (String) qualifiedExtraAttributes.get(attName); if (v == null) { v = (String) extraAttributes.get(attName); } return v; } protected void setExtraAttribute(String attName, String attValue) { qualifiedExtraAttributes.put(attName, attValue); // unqualify att name if required int index = attName.indexOf(':'); if (index != -1) { attName = attName.substring(index + 1); } extraAttributes.put(attName, attValue); attributes.put(attName, attValue); } protected void setStandardAttribute(String attName, String attValue) { attributes.put(attName, attValue); } public Map getAttributes() { return unmodifiableAttributesView; } public Map getExtraAttributes() { return unmodifiableExtraAttributesView; } public Map getQualifiedExtraAttributes() { return unmodifiableQualifiedExtraAttributesView; } }
34.31
100
0.675896
782fc517ae0e75396286c2f46e0703424936058d
1,155
kt
Kotlin
server/src/main/kotlin/com/czf/udp/UDPController.kt
czf0613/TCP-presentation
7e81e32abb7a922f63ddf684699797666a955c83
[ "MIT" ]
1
2020-12-03T01:45:42.000Z
2020-12-03T01:45:42.000Z
server/src/main/kotlin/com/czf/udp/UDPController.kt
czf0613/TCP-presentation
7e81e32abb7a922f63ddf684699797666a955c83
[ "MIT" ]
null
null
null
server/src/main/kotlin/com/czf/udp/UDPController.kt
czf0613/TCP-presentation
7e81e32abb7a922f63ddf684699797666a955c83
[ "MIT" ]
null
null
null
package com.czf.udp import com.czf.tcp.UDPCompanion import com.czf.tcp.UDPMessage import org.springframework.beans.factory.annotation.Value import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.integration.annotation.ServiceActivator import org.springframework.integration.annotation.Transformer import org.springframework.integration.ip.udp.UnicastReceivingChannelAdapter import org.springframework.messaging.Message @Configuration class UDPController { @Value("\${udp.port}") private var port = 12345 @Bean fun getUnicastReceivingChannelAdapter(): UnicastReceivingChannelAdapter { return UnicastReceivingChannelAdapter(port).apply { setOutputChannelName("udp") } } @Transformer(inputChannel = "udp", outputChannel = "udpString") fun transformer(message: Message<*>): String? { return String((message.payload as ByteArray)) } @ServiceActivator(inputChannel="udpString") fun save(message: String) { println(message) UDPCompanion.messageQueue.add(UDPMessage(message)) } }
33
77
0.761039
f07a7df9283116337443c3a5f4f80b400ad900a1
4,848
py
Python
tests/data/test_make_dataset.py
dnsosa/drug-lit-contradictory-claims
c03faa7269050344b631b12302214a3175384e98
[ "MIT" ]
null
null
null
tests/data/test_make_dataset.py
dnsosa/drug-lit-contradictory-claims
c03faa7269050344b631b12302214a3175384e98
[ "MIT" ]
null
null
null
tests/data/test_make_dataset.py
dnsosa/drug-lit-contradictory-claims
c03faa7269050344b631b12302214a3175384e98
[ "MIT" ]
null
null
null
"""Tests for making datasets for contradictory-claims.""" # -*- coding: utf-8 -*- import os import unittest from contradictory_claims.data.make_dataset import load_drug_virus_lexicons, load_mancon_corpus_from_sent_pairs, \ load_med_nli, load_multi_nli from .constants import drug_lex_path, mancon_sent_pairs, mednli_dev_path, mednli_test_path, mednli_train_path, \ multinli_test_path, multinli_train_path, sample_drug_lex_path, sample_mancon_sent_pairs, \ sample_multinli_test_path, sample_multinli_train_path, sample_virus_lex_path, virus_lex_path class TestMakeDataset(unittest.TestCase): """Tests for making datasets for contradictory-claims.""" @unittest.skip("This test can be used to check that datasets are found at the correct locations locally") def test_find_files(self): """Test that input files are found properly.""" self.assertTrue(os.path.isfile(multinli_train_path), "MultiNLI training data not found at {}".format(multinli_train_path)) self.assertTrue(os.path.isfile(multinli_test_path), "MultiNLI test data not found at {}".format(multinli_test_path)) self.assertTrue(os.path.isfile(mednli_train_path), "MedNLI training data not found at {}".format(mednli_train_path)) self.assertTrue(os.path.isfile(mednli_dev_path), "MedNLI dev set data not found at {}".format(mednli_dev_path)) self.assertTrue(os.path.isfile(mednli_test_path), "MedNLI test data not found at {}".format(mednli_test_path)) self.assertTrue(os.path.isfile(mancon_sent_pairs), "ManConCorpus sentence pairs training data not found at {}".format(mancon_sent_pairs)) self.assertTrue(os.path.isfile(drug_lex_path), "Drug lexicon not found at {}".format(drug_lex_path)) self.assertTrue(os.path.isfile(virus_lex_path), "Virus lexicon not found at {}".format(virus_lex_path)) @unittest.skip("This test can be used locally to check that MultiNLI loads properly") def test_load_multi_nli(self): """Test that MultiNLI is loaded as expected.""" x_train, y_train, x_test, y_test = load_multi_nli(multinli_train_path, multinli_test_path) self.assertEqual(len(x_train), 391165) self.assertEqual(y_train.shape, (391165, 3)) self.assertEqual(len(x_test), 9897) self.assertEqual(y_test.shape, (9897, 3)) def test_load_multi_nli_sample(self): """Test that MultiNLI SAMPLE DATA are loaded as expected.""" x_train, y_train, x_test, y_test = load_multi_nli(sample_multinli_train_path, sample_multinli_test_path) self.assertEqual(len(x_train), 49) self.assertEqual(y_train.shape, (49, 3)) self.assertEqual(len(x_test), 49) self.assertEqual(y_test.shape, (49, 3)) @unittest.skip("This test can be used locally to check that MedNLI loads properly") def test_load_med_nli(self): """Test that MedNLI is loaded as expected.""" x_train, y_train, x_test, y_test = load_med_nli(mednli_train_path, mednli_dev_path, mednli_test_path) self.assertEqual(len(x_train), 12627) self.assertEqual(y_train.shape, (12627, 3)) self.assertEqual(len(x_test), 1422) self.assertEqual(y_test.shape, (1422, 3)) @unittest.skip("This test can be used locally to check that ManConCorpus loads properly") def test_load_mancon_corpus_from_sent_pairs(self): """Test that ManConCorpus is loaded as expected.""" x_train, y_train, x_test, y_test = load_mancon_corpus_from_sent_pairs(mancon_sent_pairs) self.assertEqual(len(x_train), 14328) self.assertEqual(y_train.shape, (14328, 3)) self.assertEqual(len(x_test), 3583) self.assertEqual(y_test.shape, (3583, 3)) def test_load_mancon_corpus_from_sent_pairs_sample(self): """Test that ManConCorpus is loaded as expected.""" x_train, y_train, x_test, y_test = load_mancon_corpus_from_sent_pairs(sample_mancon_sent_pairs) self.assertEqual(len(x_train), 39) self.assertEqual(y_train.shape, (39, 3)) self.assertEqual(len(x_test), 10) self.assertEqual(y_test.shape, (10, 3)) def test_load_drug_virus_lexicons(self): """Test that the virus and drug lexicons are loaded properly.""" drug_names, virus_names = load_drug_virus_lexicons(sample_drug_lex_path, sample_virus_lex_path) drugs = ["hydroxychloroquine", "remdesivir", "ritonavir", "chloroquine", "lopinavir"] virus_syns = ["COVID-19", "SARS-CoV-2", "Coronavirus Disease 2019"] self.assertTrue(set(drugs).issubset(set(drug_names))) self.assertTrue(set(virus_syns).issubset(set(virus_names)))
49.469388
114
0.697401
c12d42bfe8e9ae36bc735910841b66c377403d0c
150
kt
Kotlin
lib_core/src/main/java/com/yg/lib_core/bean/UserInfoBean.kt
yang95C/NewsProject
213d8f8000aaa23c429a347ac5dec1647fb49b69
[ "Apache-2.0" ]
null
null
null
lib_core/src/main/java/com/yg/lib_core/bean/UserInfoBean.kt
yang95C/NewsProject
213d8f8000aaa23c429a347ac5dec1647fb49b69
[ "Apache-2.0" ]
null
null
null
lib_core/src/main/java/com/yg/lib_core/bean/UserInfoBean.kt
yang95C/NewsProject
213d8f8000aaa23c429a347ac5dec1647fb49b69
[ "Apache-2.0" ]
null
null
null
package com.yg.lib_core.bean data class UserInfoBean (val id :String, var nickName:String, var headUrl: String, val mobile:String, val token:String)
37.5
119
0.786667
0d03dc0bf47024c5ece8160a24894d4147220a8c
2,451
kt
Kotlin
link-ui/src/main/java/com/tink/link/ui/MainViewModel.kt
jrodriguezva/tink-link-android
9e7ee709cfc26dd8188f230dda05c6a9b64c18b3
[ "MIT" ]
4
2020-05-11T09:19:32.000Z
2021-08-11T10:59:31.000Z
link-ui/src/main/java/com/tink/link/ui/MainViewModel.kt
jrodriguezva/tink-link-android
9e7ee709cfc26dd8188f230dda05c6a9b64c18b3
[ "MIT" ]
7
2021-04-02T13:43:49.000Z
2022-01-28T15:24:23.000Z
link-ui/src/main/java/com/tink/link/ui/MainViewModel.kt
jrodriguezva/tink-link-android
9e7ee709cfc26dd8188f230dda05c6a9b64c18b3
[ "MIT" ]
8
2020-03-10T12:00:40.000Z
2022-03-09T10:34:00.000Z
package com.tink.link.ui import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import com.tink.core.Tink import com.tink.core.provider.ProviderRepository import com.tink.link.core.credentials.CredentialsRepository import com.tink.link.core.user.UserContext import com.tink.link.getUserContext import com.tink.model.credentials.Credentials import com.tink.model.provider.Provider import com.tink.service.handler.ResultHandler internal class MainViewModel : ViewModel() { private val userContext: UserContext = requireNotNull(Tink.getUserContext()) private val credentialsRepository: CredentialsRepository = userContext.credentialsRepository private val providerRepository: ProviderRepository = userContext.providerRepository private val _credentialsToProvider: MutableLiveData<CredentialsToProvider> = MutableLiveData() val credentialsToProvider: LiveData<CredentialsToProvider> = _credentialsToProvider private val _onError: MutableLiveData<TinkLinkError> = MutableLiveData() val onError: LiveData<TinkLinkError> = _onError fun setCredentialsId(credentialsId: String) { credentialsRepository.getCredentials( credentialsId, ResultHandler( { credentials -> providerRepository.getProvider( credentials.providerName, ResultHandler( { provider -> if (provider != null) { _credentialsToProvider.postValue( CredentialsToProvider(credentials, provider) ) } else { _onError.postValue(TinkLinkError.ProviderNotFound(credentials.providerName)) } }, { _onError.postValue(TinkLinkError.ProviderNotFound(credentials.providerName)) } ) ) }, { _onError.postValue(TinkLinkError.CredentialsNotFound(credentialsId)) } ) ) } } internal data class CredentialsToProvider( val credentials: Credentials, val provider: Provider )
39.532258
112
0.607507
59fd2e53ab77246c06d8db1c21f90c4b710321bc
330
asm
Assembly
oeis/005/A005856.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/005/A005856.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/005/A005856.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A005856: The coding-theoretic function A(n,10,8). ; 1,1,1,1,1,2,2,3,4,6,9,12,17,21 mov $2,$0 lpb $0 sub $2,5 mov $0,$2 add $1,1 lpb $2 add $1,1 lpb $2 mov $4,$3 cmp $4,0 add $3,$4 sub $0,$3 sub $1,$3 add $1,$0 trn $2,2 lpe trn $2,8 lpe lpe mov $0,$1 add $0,1
13.2
51
0.457576
333cbce822c052930f99bc486fefc96119100d08
386
swift
Swift
app/Skyscanner/Views/Search/SearchRouter.swift
rcasanovan/Skyscanner
3765dfdbc7a6e90bcf1d839fd8f53e3f88c46e4e
[ "Apache-2.0" ]
null
null
null
app/Skyscanner/Views/Search/SearchRouter.swift
rcasanovan/Skyscanner
3765dfdbc7a6e90bcf1d839fd8f53e3f88c46e4e
[ "Apache-2.0" ]
null
null
null
app/Skyscanner/Views/Search/SearchRouter.swift
rcasanovan/Skyscanner
3765dfdbc7a6e90bcf1d839fd8f53e3f88c46e4e
[ "Apache-2.0" ]
null
null
null
// // SearchRouter.swift // Skyscanner // // Created by Ricardo Casanova on 12/12/2018. // Copyright © 2018 Skyscanner. All rights reserved. // import UIKit class SearchRouter { public static func setupModule(navigationController: UINavigationController? = nil) -> SearchViewController { let searchVC = SearchViewController() return searchVC } }
20.315789
113
0.689119
46364e8834db099b942a076e60e45c4d914b79f9
1,866
lua
Lua
BGAnimations/ScreenGameplay underlay/PerPlayer/StepStatistics/SongBackground.lua
Fieoner/Simply-Love-SM5-Horizontal
051aee51934a2a9865659958d460c9404a0584be
[ "MIT" ]
1
2021-11-19T20:04:34.000Z
2021-11-19T20:04:34.000Z
BGAnimations/ScreenGameplay underlay/PerPlayer/StepStatistics/SongBackground.lua
Fieoner/Simply-Love-SM5-Horizontal
051aee51934a2a9865659958d460c9404a0584be
[ "MIT" ]
null
null
null
BGAnimations/ScreenGameplay underlay/PerPlayer/StepStatistics/SongBackground.lua
Fieoner/Simply-Love-SM5-Horizontal
051aee51934a2a9865659958d460c9404a0584be
[ "MIT" ]
null
null
null
local player = ... -- AspectRatios is a global table defined in _fallback/Scripts/02 Utilities.lua -- that lists aspect ratios supported by SM5 as key/value pairs. I am misusing it here to index -- my own crop_amount table with the numbers it provides so I can look up how much to crop the -- song's background by. Indexing with floating-point keys seems inadvisable, but I don't have -- enough CS background to say for certain. I'll change this if (when) issues are identified. local crop_amount = { -- notefield is not centered [false] = { [AspectRatios.FourThree] = 0.5, [AspectRatios.SixteenNine] = 0.5, [AspectRatios.SixteenTen] = 0.5, }, -- notefield is centered [true] = { -- centered notefield + 4:3 AspectRatio means that StepStats should be disabled and we -- should never get here, but specify 1 to crop the entire background away Just In Case. [AspectRatios.FourThree] = 1, -- These are supported, however, when the notefield is centered. [AspectRatios.SixteenNine] = 0.3515, [AspectRatios.SixteenTen] = 0.333333, } } return Def.Sprite{ InitCommand=function(self) -- round the DisplayAspectRatio value from the user's Preferences.ini file to not exceed -- 5 decimal places of precision to match the AspectRatios table from the _fallback theme local ar = round(PREFSMAN:GetPreference("DisplayAspectRatio"), 5) local centered = PREFSMAN:GetPreference("Center1Player") if player == PLAYER_1 then self:cropright( crop_amount[centered][ar] ) elseif player == PLAYER_2 then self:cropleft( crop_amount[centered][ar] ) end end, CurrentSongChangedMessageCommand=function(self) -- Background scaling and cropping is handled by the _fallback theme via -- scale_or_crop_background(), which is defined in _fallback/Scripts/02 Actor.lua self:LoadFromCurrentSongBackground():scale_or_crop_background() end }
38.875
96
0.750268
0c873f69a18440e8e7c7b2463204d9290fbcbf4a
6,513
py
Python
fsmonitor/polling.py
ljmccarthy/fsmonitor
4d84d9817dce7b274cb4586b5c2091dea96982f9
[ "MIT" ]
26
2018-03-24T06:38:19.000Z
2022-02-18T10:22:51.000Z
fsmonitor/polling.py
ljmccarthy/fsmonitor
4d84d9817dce7b274cb4586b5c2091dea96982f9
[ "MIT" ]
5
2018-06-19T21:35:00.000Z
2018-06-26T21:11:38.000Z
fsmonitor/polling.py
ljmccarthy/fsmonitor
4d84d9817dce7b274cb4586b5c2091dea96982f9
[ "MIT" ]
9
2018-06-19T21:35:53.000Z
2022-03-26T17:01:11.000Z
# Copyright (c) 2012 Luke McCarthy <luke@iogopro.co.uk> # # This is free software released under the MIT license. # See COPYING file for details, or visit: # http://www.opensource.org/licenses/mit-license.php # # The file is part of FSMonitor, a file-system monitoring library. # https://github.com/shaurz/fsmonitor import sys, os, time, threading, errno from .common import FSEvent, FSMonitorError def get_dir_contents(path): return [(filename, os.stat(os.path.join(path, filename))) for filename in os.listdir(path)] class FSMonitorDirWatch(object): def __init__(self, path, flags, user): self.path = path self.flags = flags self.user = user self.enabled = True self._timestamp = time.time() try: self._contents = get_dir_contents(path) self._deleted = False except OSError as e: self._contents = [] self._deleted = (e.errno == errno.ENOENT) def __repr__(self): return "<FSMonitorDirWatch %r>" % self.path @classmethod def new_state(cls, path): return [(filename, os.stat(os.path.join(path, filename))) for filename in os.listdir(path)] def getstate(self): return self._contents def delstate(self): self._contents = [] self._deleted = True def setstate(self, state): self._contents = state self._deleted = False state = property(getstate, setstate, delstate) class FSMonitorFileWatch(object): def __init__(self, path, flags, user): self.path = path self.flags = flags self.user = user self.enabled = True self._timestamp = time.time() try: self._stat = os.stat(path) self._deleted = False except OSError as e: self._stat = None self._deleted = (e.errno == errno.ENOENT) def __repr__(self): return "<FSMonitorFileWatch %r>" % self.path @classmethod def new_state(cls, path): return os.stat(path) def getstate(self): return self._stat def delstate(self): self._stat = None self._deleted = True def setstate(self, state): self._stat = state self._deleted = False state = property(getstate, setstate, delstate) class FSMonitorWatch(object): def __init__(self, path, flags, user): self.path = path self.flags = flags self.user = user self.enabled = True self._timestamp = time.time() try: self._contents = get_dir_contents(path) self._deleted = False except OSError as e: self._contents = [] self._deleted = (e.errno == errno.ENOENT) def __repr__(self): return "<FSMonitorWatch %r>" % self.path def _compare_contents(watch, new_contents, events_out, before): name_to_new_stat = dict(new_contents) for name, old_stat in watch._contents: new_stat = name_to_new_stat.get(name) if new_stat: _compare_stat(watch, new_stat, events_out, before, old_stat, name) else: events_out.append(FSEvent(watch, FSEvent.Delete, name)) old_names = frozenset(x[0] for x in watch._contents) for name, new_stat in new_contents: if name not in old_names: events_out.append(FSEvent(watch, FSEvent.Create, name)) def _compare_stat(watch, new_stat, events_out, before, old_stat, filename): if new_stat.st_atime != old_stat.st_atime and new_stat.st_atime < before: events_out.append(FSEvent(watch, FSEvent.Access, filename)) if new_stat.st_mtime != old_stat.st_mtime: events_out.append(FSEvent(watch, FSEvent.Modify, filename)) def round_fs_resolution(t): if sys.platform == "win32": return t // 2 * 2 else: return t // 1 class FSMonitor(object): def __init__(self): self.__lock = threading.Lock() self.__dir_watches = set() self.__file_watches = set() self.polling_interval = 0.5 @property def watches(self): with self.__lock: return list(self.__dir_watches) + list(self.__file_watches) def add_dir_watch(self, path, flags=FSEvent.All, user=None): watch = FSMonitorDirWatch(path, flags, user) with self.__lock: self.__dir_watches.add(watch) return watch def add_file_watch(self, path, flags=FSEvent.All, user=None): watch = FSMonitorFileWatch(path, flags, user) with self.__lock: self.__file_watches.add(watch) return watch def remove_watch(self, watch): with self.__lock: if watch in self.__dir_watches: self.__dir_watches.discard(watch) elif watch in self.__file_watches: self.__file_watches.discard(watch) def remove_all_watches(self): with self.__lock: self.__dir_watches.clear() self.__file_watches.clear() def enable_watch(self, watch, enable=True): watch.enabled = enable def disable_watch(self, watch): watch.enabled = False def read_events(self, timeout=None): now = start_time = time.time() watches = self.watches watches.sort(key=lambda watch: abs(now - watch._timestamp), reverse=True) events = [] for watch in watches: now = time.time() if watch._timestamp < now: tdiff = now - watch._timestamp if tdiff < self.polling_interval: time.sleep(self.polling_interval - tdiff) watch._timestamp = now if not watch.enabled: continue before = round_fs_resolution(time.time()) try: new_state = watch.new_state(watch.path) except OSError as e: if e.errno == errno.ENOENT: if not watch._deleted: del watch.state events.append(FSEvent(watch, FSEvent.DeleteSelf)) else: if isinstance(watch, FSMonitorDirWatch): _compare_contents(watch, new_state, events, before) elif isinstance(watch, FSMonitorFileWatch): _compare_stat(watch, new_state, events, before, watch.state, watch.path) watch.state = new_state return events
29.876147
81
0.60172
127056aaca10e11000829233184d5396168bf950
1,107
c
C
core/os/spinlock.c
ithinuel/elib
0d343e62d350708d0a5f1f6b926462a66549437e
[ "Apache-2.0" ]
null
null
null
core/os/spinlock.c
ithinuel/elib
0d343e62d350708d0a5f1f6b926462a66549437e
[ "Apache-2.0" ]
null
null
null
core/os/spinlock.c
ithinuel/elib
0d343e62d350708d0a5f1f6b926462a66549437e
[ "Apache-2.0" ]
null
null
null
/* Copyright 2014 Chauveau Wilfried 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 License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Includes ------------------------------------------------------------------*/ #include "os/spinlock.h" #include "os/task.h" bool spinlock_lock(spinlock_t *this, int32_t max_delay, int32_t spin_delay) { uint32_t max = max_delay / spin_delay; // disable interrupt while ((this->is_locked) && (max > 0)) { // enable interrupt task_delay_ms(spin_delay); // disable interrupt max--; } this->is_locked = true; // disable interrupt return (max > 0); } void spinlock_unlock(spinlock_t *this) { this->is_locked = false; }
27.675
80
0.693767
71456c0d0ea05a87b692c63cfe69862355fb497e
514
ts
TypeScript
javascript/builders/src/types.ts
microsoft/showwhy
19d77a8992aadfd7b265da44aa83f4eb3342dea1
[ "MIT" ]
18
2021-12-10T15:34:44.000Z
2022-03-25T11:19:24.000Z
javascript/builders/src/types.ts
microsoft/showwhy
19d77a8992aadfd7b265da44aa83f4eb3342dea1
[ "MIT" ]
2
2022-02-10T18:25:03.000Z
2022-02-16T20:39:37.000Z
javascript/builders/src/types.ts
microsoft/showwhy
19d77a8992aadfd7b265da44aa83f4eb3342dea1
[ "MIT" ]
null
null
null
/*! * Copyright (c) Microsoft. All rights reserved. * Licensed under the MIT license. See LICENSE file in the project. */ import type { CausalityLevel } from '@showwhy/types' export interface Spec { type: CausalityLevel label?: string variable?: string } export interface PopulationSpec { type: CausalityLevel label: string dataframe: string population_id?: string } export enum NodeIds { LoadDataset = 'Load Dataset', EstimateEffects = 'Estimate Effects', SignificanceTest = 'Significance Test', }
21.416667
67
0.745136
24f73f05a886afed57021bb11524f5526c4bb663
347
kt
Kotlin
app/src/main/java/pham/honestbee/videolist/di/ActivityBindingModule.kt
theanh0512/VideoList
b715e1ce13d3fc02a5aa5295a6b0423d038ce20a
[ "Apache-1.1" ]
null
null
null
app/src/main/java/pham/honestbee/videolist/di/ActivityBindingModule.kt
theanh0512/VideoList
b715e1ce13d3fc02a5aa5295a6b0423d038ce20a
[ "Apache-1.1" ]
null
null
null
app/src/main/java/pham/honestbee/videolist/di/ActivityBindingModule.kt
theanh0512/VideoList
b715e1ce13d3fc02a5aa5295a6b0423d038ce20a
[ "Apache-1.1" ]
null
null
null
package pham.honestbee.videolist.di import dagger.Module import dagger.android.ContributesAndroidInjector import pham.honestbee.videolist.videos.MainActivity /** * Created by Pham on 25/8/2018. */ @Module abstract class ActivityBindingModule { @ActivityScoped @ContributesAndroidInjector abstract fun mainActivity(): MainActivity }
23.133333
51
0.798271
162158a6414199b000acd1b98fd36108453378d6
82
ts
TypeScript
d.ts
KarstenBuckstegge/karstenbuckstegge-gatsby
f20585eddf8d8f591dbc405cdff16c20e4c912a7
[ "MIT" ]
2
2021-01-06T12:25:31.000Z
2022-03-09T08:38:10.000Z
d.ts
KarstenBuckstegge/karstenbuckstegge-gatsby
f20585eddf8d8f591dbc405cdff16c20e4c912a7
[ "MIT" ]
8
2019-07-09T16:47:27.000Z
2022-02-17T20:47:28.000Z
d.ts
KarstenBuckstegge/karstenbuckstegge-gatsby
f20585eddf8d8f591dbc405cdff16c20e4c912a7
[ "MIT" ]
null
null
null
declare module '*.module.scss'; declare module 'react-anchor-link-smooth-scroll';
27.333333
49
0.768293
6ae2b4e8ac6b122a25573c9ec6abd9f07fef59af
9,031
asm
Assembly
blocks.asm
acmahaja/BLOCKS_Project
c24b17b63931352d6e5f85efe99d0644498f7269
[ "Apache-2.0" ]
null
null
null
blocks.asm
acmahaja/BLOCKS_Project
c24b17b63931352d6e5f85efe99d0644498f7269
[ "Apache-2.0" ]
null
null
null
blocks.asm
acmahaja/BLOCKS_Project
c24b17b63931352d6e5f85efe99d0644498f7269
[ "Apache-2.0" ]
null
null
null
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Programmer: Anjaney Chirag Mahajan ; Class: ECE 109 ; Section: 405 ; ; blocks.asm ; ; Submitted: 03/28/2017 ; ; ; The function of this program is to draw and manipulate the location of a ; box on the screen ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .ORIG x3000 JSR Initialise ; Initialize R0, R2, R3 and R4 JSR Mem_Num_128 ; Jump to Label Mem_Num_128 JSR Mem_Neg_Num_128 ; Jump to Label Mem_Neg_Num_128 LD R1, WHITE ; Load [White] -> R1 START LD R0, X ; Load [X] -> R0 AND R3, R3, #0 ; Initialise R3 ; Loop Control for X_Axis AND R4, R4, #0 ; Initialise R4 ; Loop Control for Y_Axis ADD R4, R4, #8 ; R4 = R4 + 8 Y_Axis ADD R3, R3, #8 ; R3 = R3 + 8 X_Axis STR R1, R0, #0 ; [R0] -> [R1] ADD R0, R0, #1 ; R0 = R0 + 1 ADD R3, R3, #-1 ; R3 = R3 - 1 brp X_Axis ; R3 > 0? Go to X_Axis ADD R0, R0, R6 ; R0 = R0 + R6 ADD R0, R0, #-8 ; R0 = R0 - 8 ADD R4, R4, #-1 ; R4 = R4 - 1 brp Y_Axis ; R3 > 0? Go to Y_Axis AND R0, R0, #0 ; Initialise R0 GETC ; Character Input ST R0, Input ; Store Character <- R0 ST R1, Temp_Color ; Store Temp_Color <- R1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exit_Test Test_q LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, q ; R0 = [q] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz EXIT ; R2 =0? Go to label EXIT JSR Initialise ; Initialize R0, R2, R3 and R4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Move_Test Test_w LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, w ; R0 = [w] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_w ; R2 =0? Go to label If_w JSR Initialise ; Initialize R0, R2, R3 and R4 Test_s LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, s ; R0 = [s] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_s ; R2 =0? Go to label If_s JSR Initialise ; Initialize R0, R2, R3 and R4 Test_a LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, a ; R0 = [a] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #0 ; R2 = R2 + 0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_a ; R2 =0? Go to label If_a JSR Initialise ; Initialize R0, R2, R3 and R4 Test_d LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, d ; R0 = [d] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #0 ; R2 = R2 + 0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_d ; R2 =0? Go to label If_d JSR Initialise ; Initialize R0, R2, R3 and R4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Color_Test Test_y LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, y ; R0 = [y] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_y ; R2 =0? Go to label If_y JSR Initialise ; Initialize R0, R2, R3 and R4 Test_g LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, g ; R0 = [g] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_g ; R2 =0? Go to label If_g JSR Initialise ; Initialize R0, R2, R3 and R4 Test_r LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, r ; R0 = [r] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_r ; R2 =0? Go to label If_r JSR Initialise ; Initialize R0, R2, R3 and R4 Test_b LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, b ; R0 = [b] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_b ; R2 =0? Go to label If_b JSR Initialise ; Initialize R0, R2, R3 and R4 Test_wh LD R0, Input ; R0 = [Input] Not R1, R0 ; Inverse [R0] -> R1 LD R0, wh ; R0 = [wh] ADD R2, R1, R0 ; R2 = R1 + R0 ADD R2, R2, #1 ; R2 = R2 + 1 Brz If_wh ; R2 =0? Go to label If_wh JSR Initialise ; Initialize R0, R2, R3 and R4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Results If_w JSR Clear ; Initialize R0, R2, R3 and R4 LD R1, Temp_Color ; Load Temp_Color -> R1 LD R4, X ; Load X -> R4 ADD R4, R4, R5 ADD R4, R4, R5 ADD R4, R4, R5 ADD R4, R4, R5 ADD R4, R4, R5 ADD R4, R4, R5 ADD R4, R4, R5 ADD R4, R4, R5 ; ADD R4 = R4 - 128 ST R4, X ; Store R4 -> X Brnzp START ; Go to Label START If_a JSR Clear ; Initialize R0, R2, R3 and R4 LD R1, Temp_Color ; Load Temp_Color -> R1 LD R4, X ; Load X -> R4 ADD R4, R4, #-8 ; ADD R4 = R4 - 8 ST R4, X ; Store R4 -> X Brnzp START ; Go to Label START If_s JSR Clear ; Initialize R0, R2, R3 and R4 LD R1, Temp_Color ; Load Temp_Color -> R1 LD R4, X ; Load X -> R4 ADD R4, R4, R6 ADD R4, R4, R6 ADD R4, R4, R6 ADD R4, R4, R6 ADD R4, R4, R6 ADD R4, R4, R6 ADD R4, R4, R6 ADD R4, R4, R6 ; ADD R4 = R4 + 128 ST R4, X ; Store R4 -> X Brnzp START ; Go to Label START If_d JSR Clear ; Initialize R0, R2, R3 and R4 LD R1, Temp_Color ; Load Temp_Color -> R1 LD R4, X ; Load X -> R4 ADD R4, R4, #8 ; ADD R4 = R4 + 8 ST R4, X ; Store R4 -> X Brnzp START ; Go to Label START If_r LD R1, RED ; Load RED -> R1 Brnzp START ; Go to Label START If_g LD R1, GREEN ; Load GREEN -> R1 Brnzp START ; Go to Label START If_b LD R1, BLUE ; Load BLUE -> R1 Brnzp START ; Go to Label START If_y LD R1, YELLOW ; Load YELLOW -> R1 Brnzp START ; Go to Label START If_wh LD R1, WHITE ; Load WHITE -> R1 Brnzp START ; Go to Label START Exit HALT ; End Program ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Clear LD R1, BLACK ; Load [BLACK] -> R1 LD R0, X ; Store [X] -> R0 AND R3, R3, #0 ; Initialise R3 ; Loop Control for XAxis AND R4, R4, #0 ; Initialise R4 ; Loop Control for YAxis ADD R4, R4, #8 ; R4 = R4 + 8 YAxis ADD R3, R3, #8 ; R3 = R3 + 8 XAxis STR R1, R0, #0 ; [R0] -> [R1] ADD R0, R0, #1 ; R0 = R0 + 1 ADD R3, R3, #-1 ; R3 = R3 - 1 brp XAxis ; R3 > 0? Go to XAxis ADD R0, R0, R6 ; R0 = R0 + R6 ADD R0, R0, #-8 ; R0 = R0 - 8 ADD R4, R4, #-1 ; R4 = R4 - 1 brp YAxis ; R3 > 0? Go to YAxis AND R0, R0, #0 ; Initialise R0 RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Initialise AND R0, R0, #0 AND R1, R1, #0 AND R2, R2, #0 AND R3, R3, #0 AND R4, R4, #0 RET Mem_Num_128 ADD R6, R6, #1 ; Add Decimal value #1 to R2 ADD R6, R6, R6 ; Add Decimal value #2 to R2 ADD R6, R6, R6 ; Add Decimal value #4 to R2 ADD R6, R6, R6 ; Add Decimal value #8 to R2 ADD R6, R6, R6 ; Add Decimal value #16 to R2 ADD R6, R6, R6 ; Add Decimal value #32 to R2 ADD R6, R6, R6 ; Add Decimal value #64 to R2 ADD R6, R6, R6 ; Add Decimal value #128 to R2 RET Mem_Neg_Num_128 ADD R5, R5, #-1 ; Add Decimal value #-1 to R2 ADD R5, R5, R5 ; Add Decimal value #-2 to R2 ADD R5, R5, R5 ; Add Decimal value #-4 to R2 ADD R5, R5, R5 ; Add Decimal value #-8to R2 ADD R5, R5, R5 ; Add Decimal value #-16 to R2 ADD R5, R5, R5 ; Add Decimal value #-32 to R2 ADD R5, R5, R5 ; Add Decimal value #-64 to R2 ADD R5, R5, R5 ; Add Decimal value #-128 to R2 RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; X .FILL xDF40 Input .FILL x4000 Temp_Color .FILL x4001 Temp_Storage .FILL x4002 W_Test .FILL xFF00 A_Test .FILL xFF00 D_TEST .FILL x00FF D_Test_2 .FILL xFF7F RED .FILL x7C00 GREEN .FILL x03E0 BLUE .FILL x001F YELLOW .FILL x7FED WHITE .FILL x7FFF BLACK .FILL x0000 w .FILL x0077 a .FILL x0061 s .FILL x0073 d .FILL x0064 q .FILL x0071 r .FILL x0072 g .FILL x0067 b .FILL x0062 y .FILL x0079 wh .FILL x0020 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .END
30.822526
80
0.454324
183671eac5b6fc4416aeb40f94f4a8796644a76e
293
css
CSS
field_application/field_application/static/styles/campus_field/table.css
tonylifepix/CryD-r
a38fdb003a44cd2905570424bea722316b923575
[ "Apache-2.0" ]
null
null
null
field_application/field_application/static/styles/campus_field/table.css
tonylifepix/CryD-r
a38fdb003a44cd2905570424bea722316b923575
[ "Apache-2.0" ]
null
null
null
field_application/field_application/static/styles/campus_field/table.css
tonylifepix/CryD-r
a38fdb003a44cd2905570424bea722316b923575
[ "Apache-2.0" ]
null
null
null
.date{ height: 35px; } .mor_aft{ height: 30px; } .place{ width: 150px; height: 50px; } .bold_border{ border: 5px solid #ffffff; } .bold_border_bottom{ border-bottom: 5px solid #ffffff; } .bold_border_right{ border-right: 5px solid #ffffff; } .nine{ height: 30px; }
13.318182
35
0.638225
fb190d792485d905d7bdec5d030233785ed4199c
516
go
Go
api/template/search_template.go
cinic0101/go-esconn
02f470d8f7dfc7b4ccaf2f873390eba928698125
[ "MIT" ]
null
null
null
api/template/search_template.go
cinic0101/go-esconn
02f470d8f7dfc7b4ccaf2f873390eba928698125
[ "MIT" ]
null
null
null
api/template/search_template.go
cinic0101/go-esconn
02f470d8f7dfc7b4ccaf2f873390eba928698125
[ "MIT" ]
null
null
null
package template type SearchTemplate struct { Body map[string]interface{} } func New() *SearchTemplate { return &SearchTemplate{ Body: make(map[string]interface{}), } } func (s *SearchTemplate) WithFromSize(from int, size int) *SearchTemplate { s.Body["from"] = from s.Body["size"] = size return s } func (s *SearchTemplate) MatchQuery(field string, keyword string) *SearchTemplate { s.Body["query"] = map[string]interface{} { "match": map[string]interface{} { field: keyword, }, } return s }
18.428571
83
0.69186
1cad611c72790a0d3baa5e22439553ef651011a8
1,985
css
CSS
public/css/message.css
kHasan1999/a7-homecooked
5fae456df132c2d06e822f4c0a7799c9c2b88436
[ "MIT" ]
null
null
null
public/css/message.css
kHasan1999/a7-homecooked
5fae456df132c2d06e822f4c0a7799c9c2b88436
[ "MIT" ]
null
null
null
public/css/message.css
kHasan1999/a7-homecooked
5fae456df132c2d06e822f4c0a7799c9c2b88436
[ "MIT" ]
4
2021-02-23T20:49:52.000Z
2021-02-25T20:13:26.000Z
.container { padding: 20px; } body { margin:0px; } .button { background-color: orange; border: none; color: white; padding: 10px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; } .button recipe {border-radius: 8px;} figure { border: 1px #cccccc solid; padding: 4px; margin: 20px; } img { width: 100%; height: 25%; object-fit: cover; margin: 0; padding: 5px; } .navbar { background-color: orange; width: 100%; height: 60px; border: none; bottom: 0; margin: 0; overflow: hidden; position: fixed } .btnhome { border: none; size: 9x; background-color: inherit; padding: 14px 28px; font-size: 30px; cursor: pointer; display: inline-block; color: white; float: left; } .btnadd { border: none; size: 9x; background-color: inherit; padding: 14px 28px; font-size: 30px; cursor: pointer; display: inline-block; color: white; float: right; } .btnprofile { border: none; size: 9x; background-color: inherit; padding: 14px 28px; font-size: 30px; cursor: pointer; display: inline-block; color: white; float: right; } * { box-sizing: border-box; } /* Style the search field */ form.search input[type=text] { padding: 10px; font-size: 17px; border: 1px solid #cccccc; float: left; width: 80%; background: #f1f1f1; } /* Style the submit button */ form.search button { float: left; width: 20%; height: 42px; padding: 10px; background: #cccccc; color: white; font-size: 17px; border: 1px solid grey; border-left: none; /* Prevent double borders */ cursor: pointer; } form.search button:hover { background: #cccccc; } /* Clear floats */ form.search::after { content: ""; clear: both; display: table; }
16.822034
51
0.576826
b2d418afad092a7839f43f08bf37f5d322277d2e
392
py
Python
fehler_auth/migrations/0003_auto_20220416_1626.py
dhavall13/fehler_core
dd27802d5b227a32aebcc8bfde68e78a69a36d66
[ "MIT" ]
null
null
null
fehler_auth/migrations/0003_auto_20220416_1626.py
dhavall13/fehler_core
dd27802d5b227a32aebcc8bfde68e78a69a36d66
[ "MIT" ]
null
null
null
fehler_auth/migrations/0003_auto_20220416_1626.py
dhavall13/fehler_core
dd27802d5b227a32aebcc8bfde68e78a69a36d66
[ "MIT" ]
null
null
null
# Generated by Django 2.2.27 on 2022-04-16 16:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fehler_auth', '0002_auto_20211002_1511'), ] operations = [ migrations.AlterField( model_name='invite', name='email', field=models.EmailField(max_length=255), ), ]
20.631579
52
0.604592
1665cd156a52fd6633baad6621f5ef7bf5785868
3,344
tsx
TypeScript
packages/cascader/src/popup/search-popup.tsx
illa-family/illa-design
00f4a50d9bcfe337304f6316e8e86d5c19e60e08
[ "Apache-2.0" ]
30
2021-11-25T10:49:45.000Z
2022-03-24T12:47:16.000Z
packages/cascader/src/popup/search-popup.tsx
illa-family/illa-design
00f4a50d9bcfe337304f6316e8e86d5c19e60e08
[ "Apache-2.0" ]
10
2021-11-29T11:19:53.000Z
2022-03-25T07:28:39.000Z
packages/cascader/src/popup/search-popup.tsx
illa-family/illa-design
00f4a50d9bcfe337304f6316e8e86d5c19e60e08
[ "Apache-2.0" ]
5
2021-11-24T07:50:39.000Z
2022-03-02T06:59:03.000Z
import { useEffect, useState, useRef, SyntheticEvent } from "react" import isEqual from "react-fast-compare" import { Empty } from "@illa-design/empty" import { Checkbox } from "@illa-design/checkbox" import { Node } from "../node" import { OptionProps, SearchPopupProps } from "../interface" import { applyOptionStyle, flexCenterStyle, optionLabelStyle, optionListStyle, searchListWrapper, textMargin, } from "./style" export const SearchPopup = <T extends OptionProps>( props: SearchPopupProps<T>, ) => { const { store, multiple, onChange, inputValue, style, value = [] } = props const wrapperRef = useRef<HTMLDivElement>(null) const [options, setOptions] = useState<Node<T>[]>( store?.searchNodeByLabel(inputValue) || [], ) const activeItemRef = useRef<HTMLLIElement | null>(null) const isFirst = useRef<boolean>(true) const clickOption = ( option: Node<T>, checked: boolean, e: SyntheticEvent, ) => { e?.stopPropagation() if (option.disabled) { return } if (multiple) { option.setCheckedState(checked) let checkedValues if (checked) { checkedValues = value?.concat([option.pathValue]) } else { checkedValues = value?.filter((item) => { return !isEqual(item, option.pathValue) }) } onChange?.(checkedValues) } else { onChange?.([option.pathValue]) } } const isDidMount = useRef(false) useEffect(() => { if (isDidMount.current) { if (store) { setOptions(store.searchNodeByLabel(inputValue)) } } else { isDidMount.current = true } }, [inputValue]) useEffect(() => { isFirst.current = false }, []) return options.length ? ( <div ref={wrapperRef} css={searchListWrapper} onClick={(e) => e?.stopPropagation()} > <ul css={optionListStyle} style={style}> {options.map((option, i) => { const pathNodes = option.getPathNodes() const label = pathNodes.map((x) => x.label).join(" / ") const checked = value.some((x) => { return isEqual(x, option.pathValue) }) return ( <li css={applyOptionStyle({ active: checked, disabled: option.disabled, })} ref={(node) => { if (checked && isFirst.current && !activeItemRef.current) { node?.scrollIntoView() activeItemRef.current = node } }} onClick={(e) => { clickOption(option, !checked, e) }} key={i} > {multiple ? ( <> <Checkbox css={textMargin} checked={checked} value={option.value} disabled={option.disabled} onChange={(checked, e) => { clickOption(option, checked, e) }} /> <div css={optionLabelStyle}>{label}</div> </> ) : ( label )} </li> ) })} </ul> </div> ) : ( <Empty css={flexCenterStyle} style={style} /> ) }
26.539683
76
0.513457
dd9748c7e69dea6d562404bb4852231de4cc4844
6,046
php
PHP
resources/views/website/departments.blade.php
saidabdul80/grandplusFake
a0a4b0b16f4ec1c0227a2361bc9f1a502e5c2128
[ "MIT" ]
null
null
null
resources/views/website/departments.blade.php
saidabdul80/grandplusFake
a0a4b0b16f4ec1c0227a2361bc9f1a502e5c2128
[ "MIT" ]
null
null
null
resources/views/website/departments.blade.php
saidabdul80/grandplusFake
a0a4b0b16f4ec1c0227a2361bc9f1a502e5c2128
[ "MIT" ]
null
null
null
<?php $programmes = [ '0' => [ 'id' => "1", 'name' => "Community Health", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'], ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ], 'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], '1' => [ 'id' => "1", 'name' => " Environmental Health Sciences", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ], 'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], '2' => [ 'id' => "2", 'name' => "Health Education", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ],'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], '3' => [ 'id' => "3", 'name' => "Health Information Managment", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ],'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], '4' => [ 'id' => "4", 'name' => "Human Nutrition", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ],'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], '5' => [ 'id' => "5", 'name' => "Medical Laboratory", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ],'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], '6' => [ 'id' => "6", 'name' => "Dental Health", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ],'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], '7' => [ 'id' => "7", 'name' => "Pharmacy", 'courses' => [ ['id' =>'1', 'name' => 'Name', 'requirements'=> 'requirements requirements requirements requirements'] ],'about' => 'About About About About About about About about About about About about About about', 'duration'=> '4 years' ], ]; $programmes = json_decode(json_encode($programmes)); $ids = 0; ?> @extends('layouts.website') @section('page-body') <div class="row"> <div class="col-sm-12 col-lg-8 px-5 pt-5" style=""> <h4 class="mt-3 bg-primary1 p-2"><strong class="text-white">Departments</strong></h4> <section class="border p-3"> @foreach($programmes as $program) <?php $ids += 1 ;?> <div class="shadow-sm p-3 text-primary1 mt-3 bars" style="font-weight: bold;" onclick="unveil('{{$ids}}');"><span id="rel{{$ids}}" class="rel fa fa-plus mx-3"></span> {{$program->name}}</div> @if($loop->first) <div class="p-3 department-cards" style="background: rgba(200,200,255,.1);" id="{{$ids}}" > <div><strong> About</strong></div> <div>{{$program->about}}</div> <div class="line"></div> <div><strong> Duration</strong></div> <div>{{$program->duration}}</div> <div class="line"></div> <div><strong> Courses List</strong></div> <table class="table table-bordered"> <thead class="bg-light"> <th>Course name</th> <th>Requirements</th> </thead> <tbody> @foreach($program->courses as $courses) <tr> <td>{{$courses->name}}</td> <td>{{$courses->requirements}}</td> </tr> @endforeach </tbody> </table> </div> @endif @if(!$loop->first) <div class="p-3 department-cards" id="{{$ids}}" style="display: none;background: rgba(200,200,255,.1);"> <div><strong> About</strong></div> <div>{{$program->about}}</div> <div class="line"></div> <div><strong> Duration</strong></div> <div>{{$program->duration}}</div> <div class="line"></div> <div><strong> Courses List</strong></div> <table class="table table-bordered"> <thead> <th>Course name</th> <th>Requirements</th> </thead> <tbody> @foreach($program->courses as $courses) <tr> <td>{{$courses->name}}</td> <td>{{$courses->requirements}}</td> </tr> @endforeach </tbody> </table> </div> @endif @endforeach </section> </div> <div class="col-sm-12 col-lg-4" style=""> @include('website.latest-update') </div> </div> @endsection @section('js') @endsection
36.421687
199
0.477671
fb74d6703340262b09e29e2b424f2536d47247ab
1,068
h
C
extension/Extension.h
KrokusPokus/krkrz
d5eff37e0335e4756caf0061589893370766f814
[ "BSD-3-Clause" ]
572
2015-01-02T12:47:44.000Z
2022-03-28T06:06:02.000Z
extension/Extension.h
KrokusPokus/krkrz
d5eff37e0335e4756caf0061589893370766f814
[ "BSD-3-Clause" ]
108
2015-02-24T03:06:03.000Z
2022-01-23T07:28:58.000Z
extension/Extension.h
KrokusPokus/krkrz
d5eff37e0335e4756caf0061589893370766f814
[ "BSD-3-Clause" ]
136
2015-01-24T01:29:46.000Z
2022-03-16T17:03:43.000Z
#ifndef __EXTENSION_H__ #define __EXTENSION_H__ //--------------------------------------------------------------------------- // tTVPAtInstallClass //--------------------------------------------------------------------------- extern void TVPAddClassHandler( const tjs_char* name, iTJSDispatch2* (*handler)(iTJSDispatch2*), const tjs_char* dependences ); struct tTVPAtInstallClass { tTVPAtInstallClass(const tjs_char* name, iTJSDispatch2* (*handler)(iTJSDispatch2*), const tjs_char* dependences) { TVPAddClassHandler(name, handler, dependences); } }; /* 以下のような書式で、cpp に入れておくと、VM初期化後、クラスを追加する段階で追加してくれます。 静的リンクするとクラス追加されるpluginの様な機能です。 pluginは実行時にクラス等追加しますが、extensionはビルドする時に、入れるクラスを選択する形です。 static tTVPAtInstallClass TVPInstallClassFoo (TJS_W("ClassFoo"), TVPCreateNativeClass_ClassFoo,TJS_W("Window,Layer")); 呼び出される関数にはglobalが渡されるので、必要であればそこからメンバなど取得します。 登録は呼び出し側が返り値のiTJSDispatch2をglobalに登録するので、呼び出された関数内で登録する必要 はありません。 登録時依存クラスを3番目に指定可能ですが、現在のところ無視されています。 */ extern void TVPCauseAtInstallExtensionClass( iTJSDispatch2 *global ); #endif // __EXTENSION_H__
34.451613
127
0.713483
08071c1ac97015018b82ca2476f27d75fff8e6bf
20,155
sql
SQL
tulsi_distributor (1).sql
pankaj1920/TD-Api
30657810a8105bd5b8ac0fabdae4ac93fea73fbd
[ "MIT" ]
null
null
null
tulsi_distributor (1).sql
pankaj1920/TD-Api
30657810a8105bd5b8ac0fabdae4ac93fea73fbd
[ "MIT" ]
null
null
null
tulsi_distributor (1).sql
pankaj1920/TD-Api
30657810a8105bd5b8ac0fabdae4ac93fea73fbd
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Mar 31, 2021 at 02:11 PM -- Server version: 10.4.17-MariaDB -- PHP Version: 8.0.0 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `tulsi_distributor` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE `admin` ( `id` int(11) NOT NULL, `emp_id` varchar(234) DEFAULT NULL, `first_name` varchar(250) DEFAULT NULL, `last_name` varchar(250) DEFAULT NULL, `email` varchar(250) DEFAULT NULL, `phone_number` double DEFAULT NULL, `alternate_number` varchar(234) DEFAULT NULL, `address` varchar(250) DEFAULT NULL, `aadhar_number` varchar(234) DEFAULT NULL, `aadhar_image` varchar(234) DEFAULT NULL, `profile` varchar(250) DEFAULT NULL, `company_name` varchar(250) DEFAULT NULL, `logo` varchar(250) DEFAULT NULL, `role` varchar(250) DEFAULT NULL, `date_of_birth` date DEFAULT NULL, `date_of_join` date DEFAULT NULL, `password` varchar(250) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `emp_id`, `first_name`, `last_name`, `email`, `phone_number`, `alternate_number`, `address`, `aadhar_number`, `aadhar_image`, `profile`, `company_name`, `logo`, `role`, `date_of_birth`, `date_of_join`, `password`) VALUES (1, NULL, 'admin', 'g', 'admin@gmail.com', 7760994989, '9448551256', 'mysore', '1478529630123', NULL, 'Capture over.PNG', 'designurway', NULL, 'admin', '1997-05-26', NULL, '123'); -- -------------------------------------------------------- -- -- Table structure for table `admin_brands` -- CREATE TABLE `admin_brands` ( `id` int(11) NOT NULL, `distributor_id` int(11) DEFAULT NULL, `brand_name` varchar(250) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin_brands` -- INSERT INTO `admin_brands` (`id`, `distributor_id`, `brand_name`) VALUES (1, 1, 'HAIER'), (2, 1, 'ONIDA'), (3, 2, 'BOSCH'), (4, 2, 'Voltas'), (5, 3, 'GIZMORE'), (6, 3, 'JBL'); -- -------------------------------------------------------- -- -- Table structure for table `admin_product_details` -- CREATE TABLE `admin_product_details` ( `id` int(11) NOT NULL, `brand_id` int(11) DEFAULT NULL, `product_name` varchar(250) DEFAULT NULL, `basic_amount` int(11) DEFAULT NULL, `tax` int(11) DEFAULT NULL, `total_amount` int(11) DEFAULT NULL, `status` varchar(200) DEFAULT NULL, `quantity` int(11) DEFAULT NULL, `product_image` varchar(250) DEFAULT NULL, `description` varchar(2500) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admin_product_details` -- INSERT INTO `admin_product_details` (`id`, `brand_id`, `product_name`, `basic_amount`, `tax`, `total_amount`, `status`, `quantity`, `product_image`, `description`) VALUES (1, 1, 'HR AC 1.5T 3* HS 18T-NCS3B - IDU', 1500, 18, 1770, 'Instock', 250, NULL, 'HR AC 1.5T 3* HS 18T-NCS3B - IDU'), (2, 3, 'BOSCH FRONT LOAD 7KG WAJ 24262 IN', 1500, 18, 1770, 'outofstack', 250, NULL, 'BOSCH FRONT LOAD 7KG WAJ 24262 IN'); -- -------------------------------------------------------- -- -- Table structure for table `dealer_brand` -- CREATE TABLE `dealer_brand` ( `id` int(23) NOT NULL, `sales_executive_id` int(23) DEFAULT NULL, `dealer_id` int(23) DEFAULT NULL, `product_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `dealer_brand` -- INSERT INTO `dealer_brand` (`id`, `sales_executive_id`, `dealer_id`, `product_id`) VALUES (1, 1, 1, 1), (2, 1, 1, 2); -- -------------------------------------------------------- -- -- Table structure for table `dealer_details` -- CREATE TABLE `dealer_details` ( `id` int(11) NOT NULL, `name` varchar(250) DEFAULT NULL, `shop_name` varchar(250) DEFAULT NULL, `address` varchar(250) DEFAULT NULL, `pincode` varchar(234) DEFAULT NULL, `phone_number` varchar(23) DEFAULT NULL, `profile` varchar(250) NOT NULL, `tele_number` varchar(21) DEFAULT NULL, `email` varchar(250) DEFAULT NULL, `gst_no` varchar(201) DEFAULT NULL, `latitude` double DEFAULT NULL, `longitude` double DEFAULT NULL, `dealer_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `dealer_details` -- INSERT INTO `dealer_details` (`id`, `name`, `shop_name`, `address`, `pincode`, `phone_number`, `profile`, `tele_number`, `email`, `gst_no`, `latitude`, `longitude`, `dealer_id`) VALUES (1, 'COORG REFRIGERATION & SALES CORPORATION', 'COORG REFRIGERATION & SALES CORPORATION', 'Showroom Address: 192, B Block, 10th Cross,Akkamahadevi Rd, opp. Police Station, Block A, JP Nagar,Mysuru, Karnataka 570008', '571234', '9449530106', '', '08276 271266', 'COORGREFSALESCORP@GMAIL.COM', NULL, NULL, NULL, 0), (2, 'GANAPATHY DISTRIBUTORS - MYS', 'GANAPATHY DISTRIBUTORS - MYS', '#944/1D, 2ND MAIN LAKSHMIPURAM\r\nCHAMARAJAMOHALLA\r\nOPP LAKSHMIPURAM POST OFFICE\r\nMYSURU - 570004', '570004', '9108959988', '', '9900114340', '', '29AJXPG8502H1ZQ', NULL, NULL, 0); -- -------------------------------------------------------- -- -- Table structure for table `demo` -- CREATE TABLE `demo` ( `id` int(11) NOT NULL, `address` varchar(500) DEFAULT NULL, `pincode` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `demo` -- INSERT INTO `demo` (`id`, `address`, `pincode`) VALUES (4, 'Uttrakhand', '262309'), (5, 'Delhi', '12346566'), (6, 'Banglore', '789654'); -- -------------------------------------------------------- -- -- Table structure for table `demo2` -- CREATE TABLE `demo2` ( `id` int(11) NOT NULL, `name` varchar(500) NOT NULL, `age` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `demo2` -- INSERT INTO `demo2` (`id`, `name`, `age`) VALUES (2, 'Pankaj', '25'); -- -------------------------------------------------------- -- -- Table structure for table `distributor` -- CREATE TABLE `distributor` ( `id` int(11) NOT NULL, `first_name` varchar(250) DEFAULT NULL, `last_name` varchar(250) DEFAULT NULL, `email` varchar(250) DEFAULT NULL, `phone_number` double DEFAULT NULL, `alternate_number` varchar(234) DEFAULT NULL, `address` varchar(250) DEFAULT NULL, `aadhar_number` varchar(234) DEFAULT NULL, `aadhar_image` varchar(234) DEFAULT NULL, `profile` varchar(250) DEFAULT NULL, `logo` varchar(250) DEFAULT NULL, `role` varchar(250) DEFAULT NULL, `date_of_birth` date DEFAULT NULL, `date_of_join` date DEFAULT NULL, `password` varchar(250) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `distributor` -- INSERT INTO `distributor` (`id`, `first_name`, `last_name`, `email`, `phone_number`, `alternate_number`, `address`, `aadhar_number`, `aadhar_image`, `profile`, `logo`, `role`, `date_of_birth`, `date_of_join`, `password`) VALUES (1, 'TULSI MARKETING', 'TULSI MARKETING', 'tddistributor@gmail.com', 8799663311, '96325896325', 'bangalore', '963258963258', NULL, NULL, NULL, 'distributor', NULL, NULL, '123'), (2, 'PCUBE', 'PCUBE', 'tdpcubeor@gmail.com', 8799663311, '96325896325', 'bangalore', '963258963258', NULL, NULL, NULL, 'distributor', NULL, NULL, '123'), (3, 'GUGLIYA DISTRIBUTING CO ', 'GUGLIYA DISTRIBUTING CO ', 'gugliya@gmail.com', 8799663311, '96325896325', 'bangalore', '963258963258', NULL, NULL, NULL, 'distributor', NULL, NULL, '123'); -- -------------------------------------------------------- -- -- Table structure for table `emp_login_deatils` -- CREATE TABLE `emp_login_deatils` ( `id` int(11) NOT NULL, `emp_id` varchar(234) NOT NULL, `sales_executive_id` varchar(114) NOT NULL, `profile` varchar(250) NOT NULL, `login_date` varchar(234) NOT NULL, `login_time` time NOT NULL DEFAULT current_timestamp(), `logout_time` time NOT NULL DEFAULT current_timestamp(), `latitude` varchar(80) NOT NULL, `longitude` varchar(80) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `emp_login_deatils` -- INSERT INTO `emp_login_deatils` (`id`, `emp_id`, `sales_executive_id`, `profile`, `login_date`, `login_time`, `logout_time`, `latitude`, `longitude`) VALUES (26, 'TD001', '1', '1617086618.jpg', '22-03-2021', '12:13:38', '12:13:38', '53152', '6666'), (27, '1', 'TD001', '1617086655.jpg', '09-03-2021', '12:14:15', '12:14:15', '53152', '6666'), (28, '1', 'TD001', '1617090129.jpg', '30-3-2021', '13:12:09', '13:12:09', '12.2640248', '76.6444704'), (29, '1', 'TD001', '1617095952.jpg', '30-3-2021', '14:49:12', '14:49:12', '12.2640347', '76.6444353'), (30, '1', 'TD001', '1617095953.jpg', '30-3-2021', '14:49:13', '14:49:13', '12.2640206', '76.6444794'), (31, '1', 'TD001', '1617096219.jpg', '30-3-2021', '14:53:39', '14:53:39', '12.2640415', '76.6444253'), (32, '1', 'TD001', '1617184125.jpg', '31-3-2021', '15:18:45', '15:18:45', 'null', 'null'), (33, '1', 'TD001', '1617185273.jpg', '31-3-2021', '15:37:53', '15:37:53', 'null', 'null'), (34, '1', 'TD001', '1617185737.jpg', '31-3-2021', '15:45:37', '15:45:37', 'null', 'null'), (35, '1', 'TD001', '1617185781.jpg', '31-3-2021', '15:46:21', '15:46:21', 'null', 'null'); -- -------------------------------------------------------- -- -- Table structure for table `executive_notification` -- CREATE TABLE `executive_notification` ( `id` int(23) NOT NULL, `emp_id` varchar(234) DEFAULT NULL, `route_assigned_id` int(23) DEFAULT NULL, `title` varchar(233) DEFAULT NULL, `body` varchar(233) DEFAULT NULL, `created_date` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `executive_notification` -- INSERT INTO `executive_notification` (`id`, `emp_id`, `route_assigned_id`, `title`, `body`, `created_date`) VALUES (1, 'TD001', 1, 'New Task', '#191, Suswani Towers,\r\n3rd floor, B Block, 1st stage,\r\nC-Block, JP Nagar, Mysuru', '2021-03-10 07:26:14'), (2, 'TD001', 2, 'New Task', '#191, Suswani Towers,\r\n3rd floor, B Block, 1st stage,\r\nC-Block, JP Nagar, Mysuru', '2021-03-16 07:26:14'); -- -------------------------------------------------------- -- -- Table structure for table `notification_token` -- CREATE TABLE `notification_token` ( `id` int(11) NOT NULL, `emp_id` varchar(100) NOT NULL, `token` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `notification_token` -- INSERT INTO `notification_token` (`id`, `emp_id`, `token`) VALUES (1, 'TD001', 'cTdU4mIxTBOnsTbLbhBXpS:APA91bFD7OR5ZvwQl8E5m0lNSKDSKSAm7vZ_YRaZGFPrBbF9LNafvVlyd0JCaskPrs9s6Bzmf7PO4JR0jh0TXSvZh-Dw7j6T7MvCs5qhmr3WWfY-V-UJCEFt9lWzw4_NBZeYMdaPjrJG'); -- -------------------------------------------------------- -- -- Table structure for table `order_details` -- CREATE TABLE `order_details` ( `id` int(11) NOT NULL, `sales_executive_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `ref_no` varchar(200) DEFAULT NULL, `dealer_id` int(11) DEFAULT NULL, `stock_quantity` int(11) DEFAULT NULL, `order_quantity` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `order_details` -- INSERT INTO `order_details` (`id`, `sales_executive_id`, `product_id`, `ref_no`, `dealer_id`, `stock_quantity`, `order_quantity`) VALUES (24, 1, 1, 'Refno516241', 1, 59, 0), (32, 1, 1, 'Refno818554', 1, 59, 67), (33, 1, 2, 'Refno818554', 1, 59, 60), (34, 1, 1, 'Refno680726', 1, 59, 0), (35, 1, 2, 'Refno680726', 1, 59, 0); -- -------------------------------------------------------- -- -- Table structure for table `payment_details` -- CREATE TABLE `payment_details` ( `id` int(23) NOT NULL, `reference_id` varchar(233) DEFAULT NULL, `dealer_id` varchar(233) DEFAULT NULL, `total_amount` varchar(233) DEFAULT NULL, `pending_amount` varchar(233) DEFAULT NULL, `advance_amount` varchar(233) DEFAULT NULL, `due_date` date DEFAULT current_timestamp(), `purchase_date` date DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `payment_details` -- INSERT INTO `payment_details` (`id`, `reference_id`, `dealer_id`, `total_amount`, `pending_amount`, `advance_amount`, `due_date`, `purchase_date`) VALUES (1, '111', '5', '1000', '500', '100', '2021-03-29', '2021-03-29'), (19, 'Refno545906', '1', '127500', '500', '100', '2021-03-29', '2021-03-29'), (20, 'Refno545906', '1', '180000', '500', '100', '2021-03-29', '2021-03-29'), (21, 'Refno545906', '1', '165000', '500', '100', '2021-03-29', '2021-03-29'), (22, 'Refno818554', '1', '571500', '500', '100', '2021-03-29', '2021-03-29'), (23, 'Refno680726', '1', '3000', '500', '100', '2021-03-30', '2021-03-30'); -- -------------------------------------------------------- -- -- Table structure for table `routing` -- CREATE TABLE `routing` ( `id` int(11) NOT NULL, `distributor_id` int(11) DEFAULT NULL, `sale_executive_id` int(11) DEFAULT NULL, `dealer_id` int(111) DEFAULT NULL, `order_status` varchar(250) DEFAULT NULL, `date` date NOT NULL, `login_time` time NOT NULL DEFAULT current_timestamp(), `logout_time` time DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `routing` -- INSERT INTO `routing` (`id`, `distributor_id`, `sale_executive_id`, `dealer_id`, `order_status`, `date`, `login_time`, `logout_time`) VALUES (1, 1, 1, 1, 'completed', '2021-03-16', '09:47:04', '09:47:04'), (2, 5, 1, 1, 'pending', '2021-03-17', '12:41:53', '12:41:53'), (3, 2, 1, 0, 'pending', '2021-03-16', '12:43:01', '12:43:01'), (4, 0, 0, 0, 'pending', '2021-03-16', '13:00:36', '13:00:36'); -- -------------------------------------------------------- -- -- Table structure for table `sales_executive` -- CREATE TABLE `sales_executive` ( `id` int(11) NOT NULL, `emp_id` varchar(100) DEFAULT NULL, `distributor_id` int(11) NOT NULL, `brand_id` int(11) NOT NULL, `first_name` varchar(250) DEFAULT NULL, `last_name` varchar(250) DEFAULT NULL, `email` varchar(250) DEFAULT NULL, `phone_number` double DEFAULT NULL, `otp` varchar(234) NOT NULL, `alter_number` double DEFAULT NULL, `device_id` varchar(100) DEFAULT NULL, `address` varchar(250) DEFAULT NULL, `profile` varchar(250) DEFAULT NULL, `role` varchar(234) DEFAULT NULL, `aadhar_number` int(36) DEFAULT NULL, `aadhar_image` varchar(250) DEFAULT NULL, `date_of_birth` date DEFAULT NULL, `date_of_joining` date DEFAULT NULL, `password` varchar(250) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `sales_executive` -- INSERT INTO `sales_executive` (`id`, `emp_id`, `distributor_id`, `brand_id`, `first_name`, `last_name`, `email`, `phone_number`, `otp`, `alter_number`, `device_id`, `address`, `profile`, `role`, `aadhar_number`, `aadhar_image`, `date_of_birth`, `date_of_joining`, `password`) VALUES (1, 'TD001', 1, 2, 'Pankaj', 'g', 'sale1@gmail.com', 8171831066, '8078', 9448551256, 'fdsg', 'dfdfdfd', 'new-bmw-x3-front-profile.jpg', 'SalesExecutive', 2147483647, 'arms.PNG', '1997-05-23', '2021-03-16', '123456'), (2, 'SR025', 1, 1, 'Pankyttaj', 'g', 'sale@gmail.com', 8755420120, '1924', 9448551256, NULL, 'sdsdsd', 'images/QYvtA7c56BbBKudaBenSjkA2Oro6PxXYzpTa3Zqw.png', 'SalesExecutive', 2147483647, 'Capturedd.PNG', '2000-05-14', '2021-03-11', '123456'); -- -------------------------------------------------------- -- -- Table structure for table `support` -- CREATE TABLE `support` ( `id` int(23) NOT NULL, `emp_id` varchar(233) DEFAULT NULL, `query` text DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `support` -- INSERT INTO `support` (`id`, `emp_id`, `query`) VALUES (6, 'TD001', 'ghshhs'), (7, 'TD001', 'ghshhs'), (8, 'TD001', 'hdhdb'), (9, 'TD001', 'hello'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admin` -- ALTER TABLE `admin` ADD PRIMARY KEY (`id`); -- -- Indexes for table `admin_brands` -- ALTER TABLE `admin_brands` ADD PRIMARY KEY (`id`); -- -- Indexes for table `admin_product_details` -- ALTER TABLE `admin_product_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `dealer_brand` -- ALTER TABLE `dealer_brand` ADD PRIMARY KEY (`id`); -- -- Indexes for table `dealer_details` -- ALTER TABLE `dealer_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `demo` -- ALTER TABLE `demo` ADD PRIMARY KEY (`id`); -- -- Indexes for table `demo2` -- ALTER TABLE `demo2` ADD PRIMARY KEY (`id`); -- -- Indexes for table `distributor` -- ALTER TABLE `distributor` ADD PRIMARY KEY (`id`); -- -- Indexes for table `emp_login_deatils` -- ALTER TABLE `emp_login_deatils` ADD PRIMARY KEY (`id`); -- -- Indexes for table `executive_notification` -- ALTER TABLE `executive_notification` ADD PRIMARY KEY (`id`); -- -- Indexes for table `notification_token` -- ALTER TABLE `notification_token` ADD PRIMARY KEY (`id`); -- -- Indexes for table `order_details` -- ALTER TABLE `order_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `payment_details` -- ALTER TABLE `payment_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `routing` -- ALTER TABLE `routing` ADD PRIMARY KEY (`id`); -- -- Indexes for table `sales_executive` -- ALTER TABLE `sales_executive` ADD PRIMARY KEY (`id`); -- -- Indexes for table `support` -- ALTER TABLE `support` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admin` -- ALTER TABLE `admin` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `admin_brands` -- ALTER TABLE `admin_brands` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `admin_product_details` -- ALTER TABLE `admin_product_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `dealer_brand` -- ALTER TABLE `dealer_brand` MODIFY `id` int(23) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `dealer_details` -- ALTER TABLE `dealer_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `demo` -- ALTER TABLE `demo` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `demo2` -- ALTER TABLE `demo2` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `distributor` -- ALTER TABLE `distributor` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `emp_login_deatils` -- ALTER TABLE `emp_login_deatils` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT for table `executive_notification` -- ALTER TABLE `executive_notification` MODIFY `id` int(23) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `notification_token` -- ALTER TABLE `notification_token` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `order_details` -- ALTER TABLE `order_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36; -- -- AUTO_INCREMENT for table `payment_details` -- ALTER TABLE `payment_details` MODIFY `id` int(23) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24; -- -- AUTO_INCREMENT for table `routing` -- ALTER TABLE `routing` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `sales_executive` -- ALTER TABLE `sales_executive` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `support` -- ALTER TABLE `support` MODIFY `id` int(23) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
30.865237
313
0.65552
a10404b4adcdc7713a894e8af91776d55d58d0fa
2,311
go
Go
api/play_game.go
darkLord19/ChainReaction
460cd66386734e789548c35f414e459aa13e5741
[ "MIT" ]
3
2020-04-13T08:57:23.000Z
2020-04-14T05:03:15.000Z
api/play_game.go
darkLord19/ChainReaction
460cd66386734e789548c35f414e459aa13e5741
[ "MIT" ]
2
2020-04-13T08:59:03.000Z
2020-05-08T20:51:31.000Z
api/play_game.go
darkLord19/chainreaction
460cd66386734e789548c35f414e459aa13e5741
[ "MIT" ]
1
2020-04-14T06:07:28.000Z
2020-04-14T06:07:28.000Z
package api import ( "log" "net/http" "strings" "github.com/chainreaction/constants" "github.com/chainreaction/datastore" "github.com/chainreaction/helpers" "github.com/chainreaction/models" "github.com/chainreaction/simulate" "github.com/chainreaction/utils" "github.com/gin-gonic/gin" ) // StartGamePlay start websocket connection with clients for game play func StartGamePlay(c *gin.Context) { var ret gin.H roomname := strings.ToLower(c.Param("name")) if roomname == "" { ret = gin.H{"Error": "Please provide a game instance id"} log.Println(ret) c.AbortWithStatusJSON(http.StatusBadRequest, ret) return } uname := strings.ToLower(c.Query("username")) if uname == "" { ret = gin.H{"Error": "username cannot be empty."} log.Println(ret) c.AbortWithStatusJSON(http.StatusBadRequest, ret) return } gInstance, exists := datastore.GetGameInstance(roomname) if gInstance.GetCurrentActivePlayersCount() == gInstance.PlayersCount { ret = gin.H{"Error": "Game is already full."} log.Println(ret) c.AbortWithStatusJSON(http.StatusBadRequest, ret) return } if !exists { ret = gin.H{"Error": "Wrong room name"} log.Println(ret) c.AbortWithStatusJSON(http.StatusBadRequest, ret) return } player, _ := gInstance.GetPlayerByUsername(uname) if player == nil { ret = gin.H{"Error": "No such user exists in this game"} log.Println(ret) c.AbortWithStatusJSON(http.StatusBadRequest, ret) return } gInstance.IncCurrentActivePlayers() ws, err := utils.WsUpgrader.Upgrade(c.Writer, c.Request, nil) if err != nil { log.Fatal(err) return } defer ws.Close() player.SetWsConnection(ws) go helpers.UpdatedBoardUpdates(gInstance) go helpers.BroadcastWinner(gInstance) go helpers.BroadcastDefeated(gInstance) for gInstance.GetCurrentActivePlayersCount() != gInstance.PlayersCount { continue } for { var move models.MoveMsg err := ws.ReadJSON(&move) if err != nil { log.Printf("error: %v", err) continue } if move.PlayerUserName == gInstance.AllPlayers[gInstance.CurrentTurn].UserName { gInstance.RecvMove <- move gInstance.SetNewCurrentTurn() err = simulate.ChainReaction(gInstance, move) if err != nil { helpers.NotifyIndividual(player, models.ErrMsg{constants.InvalidMoveMsg, err.Error()}) } } } }
23.581633
90
0.720467
430336fcba6d30d08495b4406cd6ee58ee5f2bfc
1,339
swift
Swift
MarvelChallenge/Networking/Alert.swift
carlosmobile/MarvelChallenge
904c92542681a04d16dd7dfc79eb28e6b4977306
[ "MIT" ]
null
null
null
MarvelChallenge/Networking/Alert.swift
carlosmobile/MarvelChallenge
904c92542681a04d16dd7dfc79eb28e6b4977306
[ "MIT" ]
null
null
null
MarvelChallenge/Networking/Alert.swift
carlosmobile/MarvelChallenge
904c92542681a04d16dd7dfc79eb28e6b4977306
[ "MIT" ]
null
null
null
// // Alert.swift // MarvelChallenge // // Created by Carlos Butrón on 9/3/22. // import UIKit struct Alert { static func present(_ message: String, actions: [Alert.Action], from controller: UIViewController) { let alertTitle = "errorTitle".localized let alertController = UIAlertController(title: alertTitle, message: message, preferredStyle: .alert) for action in actions { alertController.addAction(action.alertAction) } controller.present(alertController, animated: true, completion: nil) } } extension Alert { enum Action { case ok(handler: (() -> Void)?) case close private var title: String { switch self { case .ok: return "ok".localized case .close: return "close".localized } } private var handler: (() -> Void)? { switch self { case .ok(let handler): return handler case .close: return nil } } var alertAction: UIAlertAction { return UIAlertAction(title: title, style: .default, handler: { _ in if let handler = self.handler { handler() } }) } } }
23.910714
108
0.525019
fea08e21a6435bb2fd802945eea5aa9640ac1cbb
13,109
sql
SQL
rekrutmen (1).sql
anggakes/rekrutmen
551a3424b15c989de7a1adedb13ec4d3fc703d6d
[ "MIT" ]
2
2015-06-02T02:05:46.000Z
2016-01-06T09:05:14.000Z
rekrutmen (1).sql
anggakes/ahplisa
551a3424b15c989de7a1adedb13ec4d3fc703d6d
[ "MIT" ]
null
null
null
rekrutmen (1).sql
anggakes/ahplisa
551a3424b15c989de7a1adedb13ec4d3fc703d6d
[ "MIT" ]
4
2017-04-12T10:50:59.000Z
2021-11-23T10:02:57.000Z
-- phpMyAdmin SQL Dump -- version 4.2.7.1 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: 01 Mar 2015 pada 06.40 -- Versi Server: 5.6.20 -- PHP Version: 5.5.15 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `rekrutmen` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `kriteria` -- CREATE TABLE IF NOT EXISTS `kriteria` ( `id_kriteria` int(5) NOT NULL, `parent_kriteria` int(5) DEFAULT NULL, `kode_kriteria` varchar(10) NOT NULL, `nama_kriteria` varchar(100) DEFAULT NULL, `keterangan` varchar(100) DEFAULT NULL, `subkriteria` enum('true','false') NOT NULL DEFAULT 'false' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=79 ; -- -- Dumping data untuk tabel `kriteria` -- INSERT INTO `kriteria` (`id_kriteria`, `parent_kriteria`, `kode_kriteria`, `nama_kriteria`, `keterangan`, `subkriteria`) VALUES (53, NULL, 'K1', 'IPK', 'aa', 'false'), (54, NULL, 'K2', 'Pendidikan', '', 'false'), (55, NULL, 'K3', 'Identitas Diri', '<br>', 'true'), (56, NULL, 'K4', 'Psikotes', '', 'false'), (57, NULL, 'K5', 'Wawancara', '<span class="Apple-tab-span" > </span>', 'true'), (68, 55, 'K3SK1', 'Proporsional', '', 'false'), (69, 55, 'K3SK2', 'Usia', '', 'false'), (70, 55, 'K3SK3', 'Ketekunan', '', 'false'), (71, 57, 'K5SKK1', 'Komunikasi', '', 'false'), (72, 57, 'K5SKD2', 'Dampak', '', 'false'), (73, 57, 'K5SKM3', 'Motivasi', '', 'false'), (75, 57, 'K5SKW4', 'Wawasan', '', 'false'), (76, 57, 'K5SKP5', 'Pengendalian Diri', '', 'false'), (77, 57, 'K5SKS6', 'Keterampilan Sosial', '', 'false'), (78, 57, 'K5SKI7', 'Inisiatif', '', 'false'); -- -------------------------------------------------------- -- -- Struktur dari tabel `lowongan` -- CREATE TABLE IF NOT EXISTS `lowongan` ( `id` int(10) unsigned NOT NULL, `nama` varchar(100) NOT NULL, `deskripsi` varchar(255) NOT NULL, `berakhir` date NOT NULL, `kode_lowongan` varchar(10) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -------------------------------------------------------- -- -- Struktur dari tabel `pendidikan` -- CREATE TABLE IF NOT EXISTS `pendidikan` ( `no_peserta` int(5) NOT NULL, `pendidikan` varchar(150) DEFAULT NULL, `institusi` varchar(150) NOT NULL, `lama_pendidikan` int(5) DEFAULT NULL, `jurusan` varchar(170) DEFAULT NULL, `tahun_masuk` int(5) DEFAULT NULL, `tahun_ijazah` int(5) DEFAULT NULL, `IPK` double DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data untuk tabel `pendidikan` -- INSERT INTO `pendidikan` (`no_peserta`, `pendidikan`, `institusi`, `lama_pendidikan`, `jurusan`, `tahun_masuk`, `tahun_ijazah`, `IPK`) VALUES (1, 'D3', 'Universitas Sriwijaya', 4, 'Sistem Informasi Bilingual', 2010, 2014, 3.6), (2, 'D3', 'a', 0, 'a', 2012, 2012, 3.9); -- -------------------------------------------------------- -- -- Struktur dari tabel `perbandingan_berpasangan` -- CREATE TABLE IF NOT EXISTS `perbandingan_berpasangan` ( `id` int(10) unsigned NOT NULL, `baris` int(11) NOT NULL, `kolom` int(11) NOT NULL, `nama` varchar(10) NOT NULL, `nilai` float NOT NULL, `parent_kriteria` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=106 ; -- -- Dumping data untuk tabel `perbandingan_berpasangan` -- INSERT INTO `perbandingan_berpasangan` (`id`, `baris`, `kolom`, `nama`, `nilai`, `parent_kriteria`) VALUES (5, 53, 53, '53_53', 1, NULL), (6, 54, 53, '54_53', 2, NULL), (7, 53, 54, '53_54', 0.5, NULL), (8, 54, 54, '54_54', 1, NULL), (9, 55, 53, '55_53', 6, NULL), (10, 53, 55, '53_55', 0.17, NULL), (11, 55, 54, '55_54', 4, NULL), (12, 54, 55, '54_55', 0.25, NULL), (13, 55, 55, '55_55', 1, NULL), (14, 56, 53, '56_53', 4, NULL), (15, 53, 56, '53_56', 0.25, NULL), (16, 56, 54, '56_54', 3, NULL), (17, 54, 56, '54_56', 0.33, NULL), (18, 56, 55, '56_55', 5, NULL), (19, 55, 56, '55_56', 0.2, NULL), (20, 56, 56, '56_56', 1, NULL), (21, 57, 53, '57_53', 3, NULL), (22, 53, 57, '53_57', 0.33, NULL), (23, 57, 54, '57_54', 2, NULL), (24, 54, 57, '54_57', 0.5, NULL), (25, 57, 55, '57_55', 4, NULL), (26, 55, 57, '55_57', 0.25, NULL), (27, 57, 56, '57_56', 3, NULL), (28, 56, 57, '56_57', 0.33, NULL), (29, 57, 57, '57_57', 1, NULL), (33, 68, 68, '68_68', 1, 55), (34, 69, 68, '69_68', 0.5, 55), (35, 68, 69, '68_69', 2, 55), (36, 69, 69, '69_69', 1, 55), (37, 70, 68, '70_68', 0.33, 55), (38, 68, 70, '68_70', 3, 55), (39, 70, 69, '70_69', 0.25, 55), (40, 69, 70, '69_70', 4, 55), (41, 70, 70, '70_70', 1, 55), (42, 71, 71, '71_71', 1, 57), (43, 72, 71, '72_71', 3, 57), (44, 71, 72, '71_72', 0.33, 57), (45, 72, 72, '72_72', 1, 57), (46, 73, 71, '73_71', 2, 57), (47, 71, 73, '71_73', 0.5, 57), (48, 73, 72, '73_72', 0.5, 57), (49, 72, 73, '72_73', 2, 57), (50, 73, 73, '73_73', 1, 57), (58, 75, 71, '75_71', 0.25, 57), (59, 71, 75, '71_75', 4, 57), (60, 75, 72, '75_72', 0.25, 57), (61, 72, 75, '72_75', 4, 57), (62, 75, 73, '75_73', 0.25, 57), (63, 73, 75, '73_75', 4, 57), (66, 75, 75, '75_75', 1, 57), (67, 76, 71, '76_71', 3, 57), (68, 71, 76, '71_76', 0.33, 57), (69, 76, 72, '76_72', 0.5, 57), (70, 72, 76, '72_76', 2, 57), (71, 76, 73, '76_73', 3, 57), (72, 73, 76, '73_76', 0.33, 57), (75, 76, 75, '76_75', 4, 57), (76, 75, 76, '75_76', 0.25, 57), (77, 76, 76, '76_76', 1, 57), (78, 77, 71, '77_71', 2, 57), (79, 71, 77, '71_77', 0.5, 57), (80, 77, 72, '77_72', 0.5, 57), (81, 72, 77, '72_77', 2, 57), (82, 77, 73, '77_73', 2, 57), (83, 73, 77, '73_77', 0.5, 57), (86, 77, 75, '77_75', 4, 57), (87, 75, 77, '75_77', 0.25, 57), (88, 77, 76, '77_76', 0.33, 57), (89, 76, 77, '76_77', 3, 57), (90, 77, 77, '77_77', 1, 57), (91, 78, 71, '78_71', 3, 57), (92, 71, 78, '71_78', 0.33, 57), (93, 78, 72, '78_72', 2, 57), (94, 72, 78, '72_78', 0.5, 57), (95, 78, 73, '78_73', 3, 57), (96, 73, 78, '73_78', 0.33, 57), (99, 78, 75, '78_75', 4, 57), (100, 75, 78, '75_78', 0.25, 57), (101, 78, 76, '78_76', 0.5, 57), (102, 76, 78, '76_78', 2, 57), (103, 78, 77, '78_77', 2, 57), (104, 77, 78, '77_78', 0.5, 57), (105, 78, 78, '78_78', 1, 57); -- -------------------------------------------------------- -- -- Struktur dari tabel `peserta` -- CREATE TABLE IF NOT EXISTS `peserta` ( `no_peserta` int(5) NOT NULL, `nama_peserta` varchar(200) NOT NULL, `tgl_lahir` date DEFAULT NULL, `tempat_lahir` varchar(100) DEFAULT NULL, `jenis_kelamin` enum('Laki-laki','Perempuan') DEFAULT NULL, `status` varchar(50) DEFAULT NULL, `agama` enum('Islam','Protestan','Khatolik','Hindu','Budha','Lainnya') DEFAULT 'Lainnya', `alamat` text, `kode_pos` varchar(7) DEFAULT NULL, `no_telp` varchar(20) DEFAULT NULL, `no_hp` varchar(20) DEFAULT NULL, `tinggi_badan` int(5) DEFAULT NULL COMMENT 'in cm', `berat_badan` int(5) DEFAULT NULL COMMENT 'in kilogram', `warga_negara` varchar(50) DEFAULT NULL, `hobby` varchar(200) DEFAULT NULL, `email` varchar(200) NOT NULL, `password` varchar(150) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data untuk tabel `peserta` -- INSERT INTO `peserta` (`no_peserta`, `nama_peserta`, `tgl_lahir`, `tempat_lahir`, `jenis_kelamin`, `status`, `agama`, `alamat`, `kode_pos`, `no_telp`, `no_hp`, `tinggi_badan`, `berat_badan`, `warga_negara`, `hobby`, `email`, `password`) VALUES (1, 'Rahma Fitri', '1992-11-19', 'Palembang', 'Perempuan', '0', 'Islam', 'Indonesia', '31114', '', '08981169578', 158, 40, NULL, 'ntah', 'rahmafitri92@gmail.com', '5a1a5593623cdde561bacff4477aec78'), (2, 'Frans Filasta Pratama', NULL, NULL, NULL, NULL, 'Lainnya', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'therealfrans@gmail.com', 'fff362de37277ebf4e9aff1a080770e8'); -- -------------------------------------------------------- -- -- Struktur dari tabel `prioritas` -- CREATE TABLE IF NOT EXISTS `prioritas` ( `id` int(10) unsigned NOT NULL, `id_kriteria` int(11) NOT NULL, `nilai` float NOT NULL, `parent_kriteria` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=49 ; -- -- Dumping data untuk tabel `prioritas` -- INSERT INTO `prioritas` (`id`, `id_kriteria`, `nilai`, `parent_kriteria`) VALUES (34, 53, 0.06, NULL), (35, 54, 0.11, NULL), (36, 55, 0.2, NULL), (37, 56, 0.27, NULL), (38, 57, 0.36, NULL), (39, 68, 0.52, 55), (40, 69, 0.36, 55), (41, 70, 0.13, 55), (42, 71, 0.07, 57), (43, 72, 0.21, 57), (44, 73, 0.1, 57), (45, 75, 0.04, 57), (46, 76, 0.24, 57), (47, 77, 0.12, 57), (48, 78, 0.22, 57); -- -------------------------------------------------------- -- -- Struktur dari tabel `table_ri` -- CREATE TABLE IF NOT EXISTS `table_ri` ( `id` int(10) unsigned NOT NULL, `n` int(11) NOT NULL, `nilai` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ; -- -- Dumping data untuk tabel `table_ri` -- INSERT INTO `table_ri` (`id`, `n`, `nilai`) VALUES (1, 1, 0), (2, 2, 0), (3, 3, 0.58), (4, 4, 0.9), (5, 5, 1.12), (6, 6, 1.24), (7, 7, 1.32), (8, 8, 1.41), (9, 9, 1.45), (10, 10, 1.49), (11, 11, 1.51), (12, 12, 1.48), (13, 13, 1.56), (14, 14, 1.57), (15, 15, 1.59); -- -------------------------------------------------------- -- -- Struktur dari tabel `users` -- CREATE TABLE IF NOT EXISTS `users` ( `id_user` int(4) NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(200) NOT NULL, `role` enum('manager','staff','admin') NOT NULL DEFAULT 'staff', `nama` varchar(100) NOT NULL, `jabatan` varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data untuk tabel `users` -- INSERT INTO `users` (`id_user`, `username`, `password`, `role`, `nama`, `jabatan`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'admin', 'Lisa', 'Owner'); -- -- Indexes for dumped tables -- -- -- Indexes for table `kriteria` -- ALTER TABLE `kriteria` ADD PRIMARY KEY (`id_kriteria`), ADD KEY `parent_kriteria` (`parent_kriteria`), ADD KEY `id_kriteria` (`id_kriteria`); -- -- Indexes for table `lowongan` -- ALTER TABLE `lowongan` ADD PRIMARY KEY (`id`); -- -- Indexes for table `pendidikan` -- ALTER TABLE `pendidikan` ADD PRIMARY KEY (`no_peserta`); -- -- Indexes for table `perbandingan_berpasangan` -- ALTER TABLE `perbandingan_berpasangan` ADD PRIMARY KEY (`id`), ADD KEY `baris` (`baris`), ADD KEY `kolom` (`kolom`); -- -- Indexes for table `peserta` -- ALTER TABLE `peserta` ADD PRIMARY KEY (`no_peserta`), ADD UNIQUE KEY `email` (`email`); -- -- Indexes for table `prioritas` -- ALTER TABLE `prioritas` ADD PRIMARY KEY (`id`), ADD KEY `id_kriteria` (`id_kriteria`); -- -- Indexes for table `table_ri` -- ALTER TABLE `table_ri` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id_user`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `kriteria` -- ALTER TABLE `kriteria` MODIFY `id_kriteria` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=79; -- -- AUTO_INCREMENT for table `lowongan` -- ALTER TABLE `lowongan` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `pendidikan` -- ALTER TABLE `pendidikan` MODIFY `no_peserta` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `perbandingan_berpasangan` -- ALTER TABLE `perbandingan_berpasangan` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=106; -- -- AUTO_INCREMENT for table `peserta` -- ALTER TABLE `peserta` MODIFY `no_peserta` int(5) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `prioritas` -- ALTER TABLE `prioritas` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=49; -- -- AUTO_INCREMENT for table `table_ri` -- ALTER TABLE `table_ri` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=16; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id_user` int(4) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; -- -- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables) -- -- -- Ketidakleluasaan untuk tabel `kriteria` -- ALTER TABLE `kriteria` ADD CONSTRAINT `kriteria_ibfk_1` FOREIGN KEY (`parent_kriteria`) REFERENCES `kriteria` (`id_kriteria`) ON DELETE CASCADE; -- -- Ketidakleluasaan untuk tabel `perbandingan_berpasangan` -- ALTER TABLE `perbandingan_berpasangan` ADD CONSTRAINT `perbandingan_berpasangan_ibfk_1` FOREIGN KEY (`baris`) REFERENCES `kriteria` (`id_kriteria`) ON DELETE CASCADE, ADD CONSTRAINT `perbandingan_berpasangan_ibfk_2` FOREIGN KEY (`kolom`) REFERENCES `kriteria` (`id_kriteria`) ON DELETE CASCADE; -- -- Ketidakleluasaan untuk tabel `prioritas` -- ALTER TABLE `prioritas` ADD CONSTRAINT `prioritas_ibfk_1` FOREIGN KEY (`id_kriteria`) REFERENCES `kriteria` (`id_kriteria`) ON DELETE CASCADE ON UPDATE CASCADE; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
29.326622
243
0.619651
7f3116d26fe54beda87b40098afb90c2903ab3a5
1,795
go
Go
actions/actions_test.go
billyninja/slapchop
556f726c755341b2a0432174d728ba94bacd5ce1
[ "MIT" ]
null
null
null
actions/actions_test.go
billyninja/slapchop
556f726c755341b2a0432174d728ba94bacd5ce1
[ "MIT" ]
null
null
null
actions/actions_test.go
billyninja/slapchop
556f726c755341b2a0432174d728ba94bacd5ce1
[ "MIT" ]
null
null
null
package actions import ( "github.com/julienschmidt/httprouter" "net/http" "testing" ) type mockResponseWriter struct{} func (m *mockResponseWriter) Header() (h http.Header) { return http.Header{} } func (m *mockResponseWriter) Write(p []byte) (n int, err error) { return len(p), nil } func (m *mockResponseWriter) WriteString(s string) (n int, err error) { return len(s), nil } func (m *mockResponseWriter) WriteHeader(int) {} var ac = ActionsConfig{ HostName: "localhost", Port: "3001", Host: "localhost:3001", UploadDir: "/tmp/slapcho/upload", MaxUploadSize: int64(1024 * 1024 * 5), TileSize: 64, PuzzlerHost: "", } func TestCreate(t *testing.T) { req, _ := NewfileUploadRequest("/chopit/billyninja", "uploadfile", "../test/gopher.jpg") mw := new(mockResponseWriter) params := httprouter.Params{ httprouter.Param{Key: "username", Value: "testing"}, } ac.Create(mw, req, params) } func TestReadAll(t *testing.T) { req, _ := http.NewRequest("GET", "/chopit/billyninja", nil) mw := new(mockResponseWriter) params := httprouter.Params{ httprouter.Param{Key: "username", Value: "testing"}, } ac.ReadAll(mw, req, params) } func TestRead(t *testing.T) { req, _ := http.NewRequest("GET", "/chopit/billyninja", nil) mw := new(mockResponseWriter) params := httprouter.Params{ httprouter.Param{Key: "username", Value: "testing"}, httprouter.Param{Key: "chopid", Value: "ASDQWE1111"}, } ac.Read(mw, req, params) } func TestDelete(t *testing.T) { req, _ := http.NewRequest("DELETE", "/chopit/billyninja", nil) mw := new(mockResponseWriter) params := httprouter.Params{ httprouter.Param{Key: "username", Value: "testing"}, httprouter.Param{Key: "chopid", Value: "ASDQWE1111"}, } ac.Delete(mw, req, params) }
22.160494
89
0.671866
611d789b52981ee8bdf2e467793931a566601324
329
asm
Assembly
oeis/036/A036909.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/036/A036909.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/036/A036909.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A036909: a(n) = (2/3) * 4^n * binomial(3*n, n). ; 8,160,3584,84480,2050048,50692096,1270087680,32133218304,819082035200,21002987765760,541167892561920,13999778090188800,363391162981023744,9459706464902840320,246865719056498950144,6456334894356662059008 add $0,1 seq $0,6588 ; a(n) = 4^n*(3*n)!/((2*n)!*n!). div $0,12 mul $0,8
41.125
204
0.741641
24143819b43a0771d6c007547d704719244fd2b2
922
kt
Kotlin
app/src/main/kotlin/jp/wasabeef/util/AppError.kt
wasabeef/kotlin-mvvm
130aa438e5a665f366c1fbd493a82c9b7b926c8c
[ "Apache-2.0" ]
193
2018-03-19T16:39:07.000Z
2022-03-25T08:52:56.000Z
app/src/main/kotlin/jp/wasabeef/util/AppError.kt
wasabeef/kotlin-mvvm
130aa438e5a665f366c1fbd493a82c9b7b926c8c
[ "Apache-2.0" ]
1
2019-03-11T11:39:27.000Z
2019-03-30T14:08:50.000Z
app/src/main/kotlin/jp/wasabeef/util/AppError.kt
wasabeef/kotlin-mvvm
130aa438e5a665f366c1fbd493a82c9b7b926c8c
[ "Apache-2.0" ]
58
2018-04-16T23:54:36.000Z
2021-10-31T18:00:18.000Z
package jp.wasabeef.util import java.lang.RuntimeException /** * Created by Wasabeef on 2017/12/04. */ open class AppError : RuntimeException { enum class Cause { /** ネットワーク未接続 */ UNKNOWN_HOST, /** ネットワーク通信タイムアウト */ TIMEOUT, /** ネットワーク全般 */ NETWORK, /** APIエラー全般 */ API, /** DBエラー全般 */ DB, /** その他エラー全般 */ ANY } private val causeType: Cause constructor(type: Cause = Cause.ANY) : super() { this.causeType = type } constructor(message: String?, type: Cause = Cause.ANY) : super(message) { this.causeType = type } constructor(error: Throwable?, type: Cause = Cause.ANY) : super(error) { this.causeType = type } constructor(message: String?, error: Throwable?, type: Cause = Cause.ANY) : super(message, error) { this.causeType = type } }
21.952381
103
0.558568
7981399e6f814edacecec5cc98b6cdd4318361f1
4,927
swift
Swift
Application/FunctionX/FxCloud/Widget/SubmitValidatorKeypair/FxCloudSubmitValidatorKeypairViewController.swift
FunctionX/fx-wallet-ios
d7392cb93c527ba9ba55d324b78f60ad4c980819
[ "MIT" ]
3
2021-01-26T13:36:03.000Z
2021-08-30T16:24:35.000Z
Application/FunctionX/FxCloud/Widget/SubmitValidatorKeypair/FxCloudSubmitValidatorKeypairViewController.swift
FunctionX/fx-wallet-ios
d7392cb93c527ba9ba55d324b78f60ad4c980819
[ "MIT" ]
null
null
null
Application/FunctionX/FxCloud/Widget/SubmitValidatorKeypair/FxCloudSubmitValidatorKeypairViewController.swift
FunctionX/fx-wallet-ios
d7392cb93c527ba9ba55d324b78f60ad4c980819
[ "MIT" ]
2
2020-12-11T06:19:44.000Z
2021-01-26T13:36:12.000Z
// // FxCloudSubmitValidatorKeypairViewController.swift // XWallet // // Created by HeiHuaBaiHua on 2020/5/21. // Copyright © 2020 Andy.Chan 6K. All rights reserved. // import WKKit import RxCocoa import FunctionX import SwiftyJSON import TrustWalletCore extension FxCloudSubmitValidatorKeypairViewController { override class func instance(with context: [String : Any] = [:]) -> UIViewController? { guard let wallet = context["wallet"] as? Wallet, let hrp = context["hrp"] as? String, let chainName = context["chainName"] as? String else { return nil } let vc = FxCloudSubmitValidatorKeypairViewController(wallet: wallet, hrp: hrp, chainName: chainName) if let parameter = context["parameter"] as? [String: Any] { vc.parameter = JSON(parameter) } vc.confirmHandler = context["handler"] as? (Keypair) -> Void return vc } } class FxCloudSubmitValidatorKeypairViewController: FxCloudWidgetActionViewController { required public init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } init(wallet: Wallet, hrp: String, chainName: String) { self.wallet = wallet super.init(hrp: hrp, chainName: chainName) } let wallet: Wallet var confirmHandler: ((Keypair) -> Void)? var selectCell: UITableViewCell? let selectKeypair = BehaviorRelay<Keypair?>(value: nil) override var titleText: String { TR("CloudWidget.SubValidatorKeypair.Title") } override func bindList() { super.bindList() listBinder.push(InfoTitleCell.self) { $0.titleLabel.text = TR("CloudWidget.SubValidatorKeypair.ValidatorKeys") } self.selectCell = listBinder.push(SelectKeypairCell.self) listBinder.didSeletedBlock = { [weak self] (_, _, cell) in guard let this = self, cell is SelectKeypairCell else { return } Router.showAuthorizeDappAlert(dapp: .fxCloudWidget, types: [5]) { (authVC, allow) in Router.dismiss(authVC, animated: false) { guard allow else { return } Router.showFxValidatorSelectKeypairAlert(wallet: this.wallet.wk, hrp: "\(this.hrp)valconspub") { (vc, keypair) in vc?.dismiss(animated: true, completion: nil) this.selectKeypair.accept(keypair) this.listBinder.pop(cell, refresh: false) this.listBinder.push(KeypairCell.self) { $0.view.publicKeyLabel.text = self?.validatorPublicKey } this.listBinder.refresh() } } } } } override func router(event: String, context: [String : Any]) { guard event == "delete", let cell = context[eventSender] as? UITableViewCell else { return } self.selectKeypair.accept(nil) listBinder.pop(cell, refresh: false) listBinder.push(selectCell) listBinder.refresh() } override func bindAction() { wk.view.confirmButton.title = TR("Submit_U") selectKeypair.map{ $0 == nil } .bind(to: wk.view.confirmButton.rx.isHidden) .disposed(by: defaultBag) wk.view.confirmButton.rx.tap.subscribe(onNext: { [weak self] (_) in guard let this = self, let keypair = self?.selectKeypair.value else { return } //submit and result is two step in one controller, so, router is unnecessary self?.confirmHandler?(keypair) let resultVC = FxCloudSubmitValidatorKeypairCompletedViewController(this.validatorPublicKey) this.navigationController?.pushViewController(resultVC, animated: true) }).disposed(by: defaultBag) } private var validatorPublicKey: String { guard let keypair = self.selectKeypair.value else { return "" } let validatorPKHrp = hrp + "valconspub" let validatorKeypair = FunctionXValidatorKeypair(keypair.privateKey) return validatorKeypair.encodedPublicKey(hrp: validatorPKHrp) ?? "" } } //MARK: FxCloudSubmitValidatorKeypairCompletedViewController class FxCloudSubmitValidatorKeypairCompletedViewController: FxCloudWidgetActionCompletedViewController { required public init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } init(_ publicKey: String) { self.publicKey = publicKey super.init(hrp: "", chainName: "") } let publicKey: String override func bindList() { super.bindList() listBinder.push(InfoTitleCell.self) { $0.titleLabel.text = TR("CloudWidget.SubValidatorKeypair.ValidatorKeys") } listBinder.push(KeypairCell.self, vm: publicKey) } }
39.103175
133
0.632434
b6a511f52bf0b0889317e94085300f6555b0fda0
844
lua
Lua
_preload.lua
Geno-IDE/premake-geno
9a29e440948499463284c5abe595d2c694862d4b
[ "MIT" ]
2
2021-07-17T11:44:54.000Z
2022-01-13T10:06:32.000Z
_preload.lua
Geno-IDE/premake-geno
9a29e440948499463284c5abe595d2c694862d4b
[ "MIT" ]
null
null
null
_preload.lua
Geno-IDE/premake-geno
9a29e440948499463284c5abe595d2c694862d4b
[ "MIT" ]
1
2021-07-03T19:51:17.000Z
2021-07-03T19:51:17.000Z
local p = premake p.extensions.geno = { _VERSION = "1.0.0" } -- -- Create the Geno action -- newaction { -- Metadata trigger = "geno", shortname = "Geno", description = "Generate project files for the Geno IDE: https://github.com/Geno-IDE/Geno", -- Capabilities valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Utility", }, valid_languages = { "C", "C++", }, valid_tools = { cc = { "msc", "gcc", } }, -- Workspace generatorn onWorkspace = function( wks ) p.generate( wks, ".gwks", p.extensions.geno.generateworkspace ) end, -- Project generator onProject = function( prj ) p.generate( prj, ".gprj", p.extensions.geno.generateproject ) end, } -- -- Decide when the full module should be loaded. -- return function( cfg ) return ( _ACTION == "geno" ) end
16.88
91
0.620853
e5adb4f13d0c4671534b6387a0fe7a3150d63f71
802
asm
Assembly
oeis/141/A141940.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/141/A141940.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/141/A141940.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A141940: Primes congruent to 17 mod 25. ; Submitted by Jon Maiga ; 17,67,167,317,367,467,617,967,1117,1217,1367,1567,1667,1867,2017,2267,2417,2467,2617,2767,2917,3067,3167,3217,3467,3517,3617,3767,3917,3967,4217,4517,4567,4817,4967,5167,5417,5717,5867,6067,6217,6317,6367,6917,6967,7417,7517,7717,7817,7867,8017,8117,8167,8317,8467,8867,9067,9467,9767,9817,9967,10067,10267,10567,10667,10867,11117,11317,11467,11617,11717,11867,12517,12917,12967,13217,13267,13367,13417,13567,13967,14717,14767,14867,15017,15217,15467,15667,15767,15817,16067,16217,16267,16417,16567 mov $2,$0 pow $2,2 lpb $2 mov $3,$4 add $3,16 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 add $4,50 lpe mov $0,$4 add $0,17
38.190476
500
0.72818
e8f4b23ed19c18a99bdef84f2585aee923db8769
3,306
py
Python
pyathena/util/rebin.py
changgoo/pyathena-1
c461ac3390d773537ce52393e3ebf68a3282aa46
[ "MIT" ]
1
2019-10-03T13:59:14.000Z
2019-10-03T13:59:14.000Z
pyathena/util/rebin.py
changgoo/pyathena-1
c461ac3390d773537ce52393e3ebf68a3282aa46
[ "MIT" ]
3
2020-09-23T23:36:17.000Z
2022-01-11T06:16:56.000Z
pyathena/util/rebin.py
changgoo/pyathena-1
c461ac3390d773537ce52393e3ebf68a3282aa46
[ "MIT" ]
2
2019-06-10T04:26:16.000Z
2019-12-04T22:27:02.000Z
from __future__ import print_function import numpy as np def rebin_xyz(arr, bin_factor, fill_value=None): """ Function to rebin masked 3d array. Parameters ---------- arr : ndarray Masked or unmasked 3d numpy array. Shape is assumed to be (nz, ny, nx). bin_factor : int binning factor fill_value: float If arr is a masked array, fill masked elements with fill_value. If *None*, masked elements will be neglected in calculating average. Default value is *None*. Return ------ arr_rebin: ndarray Smaller size, (averaged) 3d array. Shape is assumed to be (nz//bin_factor, ny//bin_factor, nx//bin_factor) """ if bin_factor == 1: return arr # number of cells in the z-direction and xy-direction nz0 = arr.shape[0] ny0 = arr.shape[1] nx0 = arr.shape[2] # size of binned array nz1 = nz0 // bin_factor ny1 = ny0 // bin_factor nx1 = nx0 // bin_factor if np.ma.is_masked(arr) and fill_value is not None: np.ma.set_fill_value(arr, fill_value) arr = arr.filled() # See # https://stackoverflow.com/questions/4624112/grouping-2d-numpy-array-in-average/4624923#4624923 return arr.reshape([nz1, nz0//nz1, ny1, ny0//ny1, nx1, nx0//nx1]).mean(axis=-1).mean(axis=3).mean(axis=1) def rebin_xy(arr, bin_factor, fill_value=None): """ Function to rebin masked 3d array in the x-y dimension. Parameters ---------- arr : ndarray Masked or unmasked 3d numpy array. Shape is assumed to be (nz, ny, nx). bin_factor : int binning factor fill_value: float If arr is a masked array, fill masked elements with fill_value. If *None*, masked elements will be neglected in calculating average. Default value is *None*. Return ------ arr_rebin: ndarray Smaller size, (averaged) 3d array. Shape is assumed to be (nz, ny//bin_factor, nx//bin_factor) """ if bin_factor == 1: return arr # number of cells in the z-direction and xy-direction nz = arr.shape[0] ny0 = arr.shape[1] nx0 = arr.shape[2] # size of binned array ny1 = ny0 // bin_factor nx1 = nx0 // bin_factor if np.ma.is_masked(arr) and fill_value is not None: np.ma.set_fill_value(arr, fill_value) arr = arr.filled() # See # https://stackoverflow.com/questions/4624112/grouping-2d-numpy-array-in-average/4624923#4624923 return arr.reshape([nz, ny1, ny0//ny1, nx1, nx0//nx1]).mean(axis=-1).mean(axis=2) if __name__ == '__main__': # Test of rebin_xy mask = True # Define test data big = np.ma.array([[5, 5, 1, 2], [5, 5, 2, 1], [2, 1, 1, 1], [2, 1, 1, 1]]) if mask: big.mask = [[1, 1, 0, 0], [0, 1, 1, 1], [1, 0, 1, 0], [1, 1, 1, 0]] big = np.tile(big, (1, 1, 1)) small1 = rebin_xy_masked(big, 2, fill_value=0.0) small2 = rebin_xy_masked(big, 2, fill_value=None) print('Original array\n', big) print('With fill value 0.0\n', small1) print('Without fill value\n', small2)
28.747826
109
0.578947
f15740e4503472d8982d83e20726fe0dd4127f1d
13,239
rb
Ruby
spec/lib/core_ext/array_spec.rb
Munyola/OpenSplitTime
20e1e96917fdeee4103c9492b16856d4d734f2bb
[ "MIT" ]
16
2017-04-28T14:58:39.000Z
2021-12-10T17:18:48.000Z
spec/lib/core_ext/array_spec.rb
Munyola/OpenSplitTime
20e1e96917fdeee4103c9492b16856d4d734f2bb
[ "MIT" ]
193
2016-01-31T04:39:41.000Z
2022-03-15T19:15:26.000Z
spec/lib/core_ext/array_spec.rb
Munyola/OpenSplitTime
20e1e96917fdeee4103c9492b16856d4d734f2bb
[ "MIT" ]
8
2016-05-11T22:57:33.000Z
2021-10-04T14:42:46.000Z
# frozen_string_literal: true require_relative '../../../lib/core_ext/array' RSpec.describe Array do describe '#average' do it 'computes the average of elements in the Array' do array = [1, 2, 3] expect(array.average).to eq(2) end it 'works properly when the answer is not an integer' do array = [1, 2] expect(array.average).to eq(1.5) end end describe '#elements_before' do context 'when the "inclusive" parameter is set to false' do subject { array.elements_before(element, inclusive: false) } context 'when the element is included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'ferret' } it 'returns all elements in the array indexed prior to the provided parameter' do expect(subject).to eq(%w(cat bird sheep)) end end context 'when nil is provided and the array includes a nil element' do let(:array) { [1, 2, 3, nil, 5] } let(:element) { nil } it 'returns the elements prior to nil' do expect(subject).to eq([1, 2, 3]) end end context 'when the element appears more than once' do let(:array) { %w(cat bird sheep ferret sheep coyote) } let(:element) { 'sheep' } it 'bases the result on the first match of the provided parameter' do expect(subject).to eq(%w(cat bird)) end end context 'when the first element is provided' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'cat' } it 'returns an empty array' do expect(subject).to eq([]) end end context 'when the provided parameter is not included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'buffalo' } it 'returns an empty array' do expect(subject).to eq([]) end end end context 'when the "inclusive" parameter is set to true' do subject { array.elements_before(element, inclusive: true) } context 'when the element is included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'ferret' } it 'returns all elements in the array indexed prior to the provided parameter' do expect(subject).to eq(%w(cat bird sheep ferret)) end end context 'when nil is provided and the array includes a nil element' do let(:array) { [1, 2, 3, nil, 5] } let(:element) { nil } it 'returns the elements prior to nil' do expect(subject).to eq([1, 2, 3, nil]) end end context 'when the element appears more than once' do let(:array) { %w(cat bird sheep ferret sheep coyote) } let(:element) { 'sheep' } it 'bases the result on the first match of the provided parameter' do expect(subject).to eq(%w(cat bird sheep)) end end context 'when the first element is provided' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'cat' } it 'returns the first element' do expect(subject).to eq(['cat']) end end context 'when the provided parameter is not included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'buffalo' } it 'returns an empty array' do expect(subject).to eq([]) end end end context 'when the "inclusive" parameter is not provided' do subject { array.elements_before(element) } let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'ferret' } it 'functions as thought the "inclusive" parameter were set to false' do expect(subject).to eq(%w(cat bird sheep)) end end end describe '#elements_after' do context 'when the "inclusive" parameter is set to false' do subject { array.elements_after(element, inclusive: false) } context 'when the element is included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'ferret' } it 'returns all elements in the array indexed after the provided parameter' do expect(subject).to eq(%w(coyote)) end end context 'when nil is provided and the array includes a nil element' do let(:array) { [1, 2, 3, nil, 5] } let(:element) { nil } it 'returns the elements after nil' do expect(subject).to eq([5]) end end context 'when the element appears more than once' do let(:array) { %w(cat bird sheep ferret sheep coyote) } let(:element) { 'sheep' } it 'bases the result on the first match of the provided parameter' do expect(subject).to eq(%w(ferret sheep coyote)) end end context 'when the last element is provided' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'coyote' } it 'returns an empty array' do expect(subject).to eq([]) end end context 'when the provided parameter is not included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'buffalo' } it 'returns an empty array' do expect(subject).to eq([]) end end end context 'when the "inclusive" parameter is set to true' do subject { array.elements_after(element, inclusive: true) } context 'when the element is included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'ferret' } it 'returns the element and all elements in the array indexed after the provided parameter' do expect(subject).to eq(%w(ferret coyote)) end end context 'when nil is provided and the array includes a nil element' do let(:array) { [1, 2, 3, nil, 5] } let(:element) { nil } it 'returns nil and all elements after nil' do expect(subject).to eq([nil, 5]) end end context 'when the element appears more than once' do let(:array) { %w(cat bird sheep ferret sheep coyote) } let(:element) { 'sheep' } it 'bases the result on the first match of the provided parameter' do expect(subject).to eq(%w(sheep ferret sheep coyote)) end end context 'when the last element is provided' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'coyote' } it 'returns the last element' do expect(subject).to eq(['coyote']) end end context 'when the provided parameter is not included in the array' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'buffalo' } it 'returns an empty array' do expect(subject).to eq([]) end end end context 'when the "inclusive" parameter is not provided' do subject { array.elements_after(element) } let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'ferret' } it 'functions as thought the "inclusive" parameter were set to false' do expect(subject).to eq(%w(coyote)) end end end describe '#element_before' do subject { array.element_before(element) } context 'when the element is found and is not the first element' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'sheep' } it 'returns the element immediately before the provided element' do expect(subject).to eq('bird') end end context 'when the element is found and is the first element' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'cat' } it 'returns nil' do expect(subject).to eq(nil) end end end describe '#element_after' do subject { array.element_after(element) } context 'when the element is found and is not the last element' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'sheep' } it 'returns the element immediately after the provided element' do expect(subject).to eq('ferret') end end context 'when the element is found and is the last element' do let(:array) { %w(cat bird sheep ferret coyote) } let(:element) { 'coyote' } it 'returns nil' do expect(subject).to eq(nil) end end end describe '#included_before?' do it 'returns true if the subject element is included in the array indexed prior to the index element' do array = %w(cat bird sheep ferret coyote) index_element = 'ferret' subject_element = 'bird' expect(array.included_before?(index_element, subject_element)).to eq(true) end it 'returns false if the subject element is not included in the array indexed prior to the index element' do array = %w(cat bird sheep ferret coyote) index_element = 'ferret' subject_element = 'coyote' expect(array.included_before?(index_element, subject_element)).to eq(false) end it 'returns false if the index element is not found in the array' do array = %w(cat bird sheep ferret coyote) index_element = 'buffalo' subject_element = 'bird' expect(array.included_before?(index_element, subject_element)).to eq(false) end it 'returns false if the subject element is not found in the array' do array = %w(cat bird sheep ferret coyote) index_element = 'sheep' subject_element = 'buffalo' expect(array.included_before?(index_element, subject_element)).to eq(false) end it 'works as expected when nil is provided as the index element and the subject element appears before' do array = [1, 2, 3, nil, 5] index_element = nil subject_element = 2 expect(array.included_before?(index_element, subject_element)).to eq(true) end it 'works as expected when nil is provided as the index element and the subject element does not appear before' do array = [1, 2, 3, nil, 5] index_element = nil subject_element = 5 expect(array.included_before?(index_element, subject_element)).to eq(false) end it 'works as expected when nil is provided as the subject element and appears before' do array = [1, nil, 3, 4, 5] index_element = 4 subject_element = nil expect(array.included_before?(index_element, subject_element)).to eq(true) end it 'works as expected when nil is provided as the subject element and does not appear before' do array = [1, 2, 3, 4, 5] index_element = 4 subject_element = nil expect(array.included_before?(index_element, subject_element)).to eq(false) end end describe '#included_after?' do it 'returns true if the subject element is included in the array indexed after the index element' do array = %w(cat bird sheep ferret coyote) index_element = 'bird' subject_element = 'ferret' expect(array.included_after?(index_element, subject_element)).to eq(true) end it 'returns false if the subject element is not included in the array indexed after the index element' do array = %w(cat bird sheep ferret coyote) index_element = 'bird' subject_element = 'cat' expect(array.included_after?(index_element, subject_element)).to eq(false) end it 'returns false if the index element is not found in the array' do array = %w(cat bird sheep ferret coyote) index_element = 'buffalo' subject_element = 'bird' expect(array.included_after?(index_element, subject_element)).to eq(false) end it 'returns false if the subject element is not found in the array' do array = %w(cat bird sheep ferret coyote) index_element = 'sheep' subject_element = 'buffalo' expect(array.included_after?(index_element, subject_element)).to eq(false) end it 'works as expected when nil is provided as the index element and the subject element appears after' do array = [1, nil, 3, 4, 5] index_element = nil subject_element = 4 expect(array.included_after?(index_element, subject_element)).to eq(true) end it 'works as expected when nil is provided as the index element and the subject element does not appear after' do array = [1, 2, 3, nil, 5] index_element = nil subject_element = 2 expect(array.included_after?(index_element, subject_element)).to eq(false) end it 'works as expected when nil is provided as the subject element and appears after' do array = [1, 2, 3, nil, 5] index_element = 2 subject_element = nil expect(array.included_after?(index_element, subject_element)).to eq(true) end it 'works as expected when nil is provided as the subject element and does not appear after' do array = [1, 2, 3, 4, 5] index_element = 4 subject_element = nil expect(array.included_after?(index_element, subject_element)).to eq(false) end end end
33.263819
118
0.630032
a1e05edb06f7e116547f535c747355ebb160e55d
681
h
C
src/Skybox.h
ShirokoSama/ShadingSandbox
b407aea1c018bcb46061f3d165c9671d2cb3c139
[ "MIT" ]
null
null
null
src/Skybox.h
ShirokoSama/ShadingSandbox
b407aea1c018bcb46061f3d165c9671d2cb3c139
[ "MIT" ]
null
null
null
src/Skybox.h
ShirokoSama/ShadingSandbox
b407aea1c018bcb46061f3d165c9671d2cb3c139
[ "MIT" ]
1
2019-12-05T11:50:24.000Z
2019-12-05T11:50:24.000Z
// // Created by Srf on 2018/11/14. // #ifndef CG_LAB3_SKYBOX_H #define CG_LAB3_SKYBOX_H #include <glad/glad.h> #include <string> #include <iostream> #include "../tools/ResourceManager.h" #include "../tools/Cube.h" class Skybox { public: explicit Skybox (const std::string &environmentMapPath); ~Skybox(); void Init(); void Draw(); void Draw(CubeMapTexture cubeMapTexture); CubeMapTexture getEnvironmentCubeMap(); private: void captureEquirectangularToCubeMap(); Texture2D hdrTexture; CubeMapTexture environmentCubeMap; Shader skyboxShader{}; Shader equirectangularToCubemapShader{}; Cube *cube; }; #endif //CG_LAB3_SKYBOX_H
18.916667
60
0.715125
8ad9a68ae6808dfc5b62fab1b143a33282b509c9
24,639
rs
Rust
rpc/src/services/protocol/mod.rs
sebastiencs/tezedge
567b29acc42e3d7baa3daf5da37d6cc304a880f2
[ "MIT" ]
1
2021-08-17T00:54:18.000Z
2021-08-17T00:54:18.000Z
rpc/src/services/protocol/mod.rs
sebastiencs/tezedge
567b29acc42e3d7baa3daf5da37d6cc304a880f2
[ "MIT" ]
null
null
null
rpc/src/services/protocol/mod.rs
sebastiencs/tezedge
567b29acc42e3d7baa3daf5da37d6cc304a880f2
[ "MIT" ]
null
null
null
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors // SPDX-License-Identifier: MIT //! This module exposes protocol rpc services. //! //! Rule 1: //! - if service has different implementation and uses different structs for various protocols, it have to be placed and implemented in correct subpackage proto_XYZ //! - and here will be just redirector to correct subpackage by protocol_hash //! Rule 2: //! - if service has the same implementation for various protocol, can be place directly here //! - if in new version of protocol is changed behavior, we have to splitted it here aslo by protocol_hash use std::convert::{TryFrom, TryInto}; use std::sync::Arc; use failure::{bail, format_err, Error, Fail}; use crypto::hash::{BlockHash, ChainId, FromBytesError, ProtocolHash}; use storage::{ BlockHeaderWithHash, BlockMetaStorage, BlockMetaStorageReader, BlockStorage, BlockStorageReader, }; use tezos_api::ffi::{HelpersPreapplyBlockRequest, ProtocolRpcRequest, RpcMethod, RpcRequest}; use tezos_messages::base::rpc_support::RpcJsonMap; use tezos_messages::base::signature_public_key_hash::ConversionError; use tezos_messages::protocol::{SupportedProtocol, UnsupportedProtocolError}; use tezos_new_context::context_key_owned; use crate::helpers::get_context_hash; use crate::server::RpcServiceEnvironment; use tezos_wrapper::TezedgeContextClientError; mod proto_001; mod proto_002; mod proto_003; mod proto_004; mod proto_005_2; mod proto_006; mod proto_007; mod proto_008; mod proto_008_2; use cached::proc_macro::cached; use cached::TimedSizedCache; #[derive(Debug, Fail)] pub enum RightsError { #[fail(display = "Rights error, reason: {}", reason)] ServiceError { reason: Error }, #[fail(display = "Unsupported protocol {}", protocol)] UnsupportedProtocolError { protocol: String }, } impl From<ContextParamsError> for RightsError { fn from(error: ContextParamsError) -> Self { match error { ContextParamsError::UnsupportedProtocolError { protocol } => { RightsError::UnsupportedProtocolError { protocol } } _ => RightsError::ServiceError { reason: error.into(), }, } } } impl From<failure::Error> for RightsError { fn from(error: failure::Error) -> Self { RightsError::ServiceError { reason: error } } } /// Return generated baking rights. /// /// # Arguments /// /// * `chain_id` - Url path parameter 'chain_id'. /// * `block_id` - Url path parameter 'block_id', it contains string "head", block level or block hash. /// * `level` - Url query parameter 'level'. /// * `delegate` - Url query parameter 'delegate'. /// * `cycle` - Url query parameter 'cycle'. /// * `max_priority` - Url query parameter 'max_priority'. /// * `has_all` - Url query parameter 'all'. /// * `list` - Context list handler. /// * `persistent_storage` - Persistent storage handler. /// * `state` - Current RPC collected state (head). /// /// Prepare all data to generate baking rights and then use Tezos PRNG to generate them. pub(crate) fn check_and_get_baking_rights( block_hash: &BlockHash, level: Option<&str>, delegate: Option<&str>, cycle: Option<&str>, max_priority: Option<&str>, has_all: bool, env: &RpcServiceEnvironment, ) -> Result<Option<Vec<RpcJsonMap>>, RightsError> { // get protocol and constants let context_proto_params = get_context_protocol_params(block_hash, env)?; // split impl by protocol match context_proto_params.protocol_hash { SupportedProtocol::Proto001 => proto_001::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto002 => proto_002::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto003 => proto_003::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto004 => proto_004::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto005 => panic!("not yet implemented!"), SupportedProtocol::Proto005_2 => proto_005_2::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto006 => proto_006::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto007 => proto_007::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto008 => proto_008::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto008_2 => proto_008_2::rights_service::check_and_get_baking_rights( context_proto_params, level, delegate, cycle, max_priority, has_all, env.tezedge_context(), ) .map_err(RightsError::from), } } /// Return generated endorsing rights. /// /// # Arguments /// /// * `chain_id` - Url path parameter 'chain_id'. /// * `block_id` - Url path parameter 'block_id', it contains string "head", block level or block hash. /// * `level` - Url query parameter 'level'. /// * `delegate` - Url query parameter 'delegate'. /// * `cycle` - Url query parameter 'cycle'. /// * `has_all` - Url query parameter 'all'. /// * `list` - Context list handler. /// * `persistent_storage` - Persistent storage handler. /// * `state` - Current RPC collected state (head). /// /// Prepare all data to generate endorsing rights and then use Tezos PRNG to generate them. pub(crate) fn check_and_get_endorsing_rights( block_hash: &BlockHash, level: Option<&str>, delegate: Option<&str>, cycle: Option<&str>, has_all: bool, env: &RpcServiceEnvironment, ) -> Result<Option<Vec<RpcJsonMap>>, RightsError> { // get protocol and constants let context_proto_params = get_context_protocol_params(block_hash, env)?; // split impl by protocol match context_proto_params.protocol_hash { SupportedProtocol::Proto001 => proto_001::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto002 => proto_002::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto003 => proto_003::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto004 => proto_004::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto005 => panic!("not yet implemented!"), SupportedProtocol::Proto005_2 => { proto_005_2::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from) } SupportedProtocol::Proto006 => proto_006::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto007 => proto_007::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto008 => proto_008::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from), SupportedProtocol::Proto008_2 => { proto_008_2::rights_service::check_and_get_endorsing_rights( context_proto_params, level, delegate, cycle, has_all, env.tezedge_context(), ) .map_err(RightsError::from) } } } #[derive(Debug, Fail)] pub enum VotesError { #[fail(display = "Votes error, reason: {}", reason)] ServiceError { reason: Error }, #[fail(display = "Unsupported protocol {}", protocol)] UnsupportedProtocolError { protocol: String }, #[fail(display = "This rpc is not suported in this protocol {}", protocol)] UnsupportedProtocolRpc { protocol: String }, } impl From<failure::Error> for VotesError { fn from(error: failure::Error) -> Self { VotesError::ServiceError { reason: error } } } impl From<TezedgeContextClientError> for VotesError { fn from(error: TezedgeContextClientError) -> Self { VotesError::ServiceError { reason: error.into(), } } } impl From<ConversionError> for VotesError { fn from(error: ConversionError) -> Self { VotesError::ServiceError { reason: error.into(), } } } impl From<UnsupportedProtocolError> for VotesError { fn from(error: UnsupportedProtocolError) -> Self { VotesError::UnsupportedProtocolError { protocol: error.protocol, } } } impl From<serde_json::Error> for VotesError { fn from(error: serde_json::Error) -> Self { VotesError::ServiceError { reason: error.into(), } } } impl From<FromBytesError> for VotesError { fn from(error: FromBytesError) -> Self { VotesError::ServiceError { reason: error.into(), } } } pub(crate) fn get_votes_listings( block_hash: &BlockHash, env: &RpcServiceEnvironment, ) -> Result<Option<serde_json::Value>, VotesError> { // TODO - TE-261: this will not work with Irmin right now, we should check that or // try to reimplement the missing parts on top of Irmin too. // if only_irmin { // return Err(ContextParamsError::UnsupportedProtocolError { // protocol: "only-supported-with-tezedge-context".to_string(), // }); // } let context_hash = get_context_hash(block_hash, env)?; // get protocol version let protocol_hash = if let Some(protocol_hash) = env .tezedge_context() .get_key_from_history(&context_hash, context_key_owned!("protocol"))? { ProtocolHash::try_from(protocol_hash)? } else { return Err(VotesError::ServiceError { reason: format_err!( "No protocol found in context for block_hash: {}", block_hash.to_base58_check() ), }); }; // check if we support impl for this protocol let supported_protocol = SupportedProtocol::try_from(protocol_hash)?; match supported_protocol { SupportedProtocol::Proto001 | SupportedProtocol::Proto002 => { Err(VotesError::UnsupportedProtocolRpc { protocol: supported_protocol.protocol_hash(), }) } SupportedProtocol::Proto003 => { proto_003::votes_services::get_votes_listings(env, &context_hash) } SupportedProtocol::Proto004 => { proto_004::votes_services::get_votes_listings(env, &context_hash) } SupportedProtocol::Proto005 => Err(VotesError::UnsupportedProtocolError { protocol: supported_protocol.protocol_hash(), }), SupportedProtocol::Proto005_2 => { proto_005_2::votes_services::get_votes_listings(env, &context_hash) } SupportedProtocol::Proto006 => { proto_006::votes_services::get_votes_listings(env, &context_hash) } SupportedProtocol::Proto007 => { proto_007::votes_services::get_votes_listings(env, &context_hash) } SupportedProtocol::Proto008 => { proto_008::votes_service::get_votes_listings(env, &context_hash) } SupportedProtocol::Proto008_2 => { proto_008_2::votes_service::get_votes_listings(env, &context_hash) } } } /// Get protocol context constants from context list /// (just for RPC render use-case, do not use in processing or algorithms) /// /// # Arguments /// /// * `block_id` - Url path parameter 'block_id', it contains string "head", block level or block hash. /// * `opt_level` - Optionaly input block level from block_id if is already known to prevent double code execution. /// * `list` - Context list handler. /// * `persistent_storage` - Persistent storage handler. /// * `state` - Current RPC collected state (head). pub(crate) fn get_context_constants_just_for_rpc( block_hash: &BlockHash, env: &RpcServiceEnvironment, ) -> Result<Option<RpcJsonMap>, ContextParamsError> { let context_proto_params = get_context_protocol_params(block_hash, env)?; Ok(tezos_messages::protocol::get_constants_for_rpc( &context_proto_params.constants_data, &context_proto_params.protocol_hash, )?) } // NB: handles multiple paths for RPC calls pub const TIMED_SIZED_CACHE_SIZE: usize = 500; pub const TIMED_SIZED_CACHE_TTL_IN_SECS: u64 = 60; #[cached( name = "CALL_PROTOCOL_RPC_CACHE", type = "TimedSizedCache<(ChainId, BlockHash, String), Arc<(u16, String)>>", create = "{TimedSizedCache::with_size_and_lifespan(TIMED_SIZED_CACHE_SIZE, TIMED_SIZED_CACHE_TTL_IN_SECS)}", convert = "{(chain_id.clone(), block_hash.clone(), rpc_request.ffi_rpc_router_cache_key())}", result = true )] pub(crate) fn call_protocol_rpc_with_cache( chain_param: &str, chain_id: ChainId, block_hash: BlockHash, rpc_request: RpcRequest, env: &RpcServiceEnvironment, ) -> Result<Arc<(u16, String)>, failure::Error> { let request = create_protocol_rpc_request(chain_param, chain_id, block_hash, rpc_request, &env)?; // TODO: retry? let response = env .tezos_readonly_api() .pool .get()? .api .call_protocol_rpc(request)?; Ok(Arc::new(( response.status_code(), response.body_json_string_or_empty(), ))) } pub(crate) fn call_protocol_rpc( chain_param: &str, chain_id: ChainId, block_hash: BlockHash, rpc_request: RpcRequest, env: &RpcServiceEnvironment, ) -> Result<Arc<(u16, String)>, failure::Error> { match rpc_request.meth { RpcMethod::GET => { //uses cache if the request is GET request call_protocol_rpc_with_cache(chain_param, chain_id, block_hash, rpc_request, env) } _ => { let request = create_protocol_rpc_request(chain_param, chain_id, block_hash, rpc_request, &env)?; // TODO: retry? let response = env .tezos_readonly_api() .pool .get()? .api .call_protocol_rpc(request)?; Ok(Arc::new(( response.status_code(), response.body_json_string_or_empty(), ))) } } } pub(crate) fn preapply_operations( chain_param: &str, chain_id: ChainId, block_hash: BlockHash, rpc_request: RpcRequest, env: &RpcServiceEnvironment, ) -> Result<serde_json::value::Value, failure::Error> { let request = create_protocol_rpc_request(chain_param, chain_id, block_hash, rpc_request, &env)?; // TODO: retry? let response = env .tezos_readonly_api() .pool .get()? .api .helpers_preapply_operations(request)?; Ok(serde_json::from_str(&response.body)?) } pub(crate) fn preapply_block( chain_param: &str, chain_id: ChainId, block_hash: BlockHash, rpc_request: RpcRequest, env: &RpcServiceEnvironment, ) -> Result<serde_json::value::Value, failure::Error> { let block_storage = BlockStorage::new(env.persistent_storage()); let block_meta_storage = BlockMetaStorage::new(env.persistent_storage()); let (block_header, (predecessor_block_metadata_hash, predecessor_ops_metadata_hash)) = match block_storage.get(&block_hash)? { Some(block_header) => match block_meta_storage.get_additional_data(&block_hash)? { Some(block_header_additional_data) => { (block_header, block_header_additional_data.into()) } None => bail!( "No block additioanl data found for hash: {}", block_hash.to_base58_check() ), }, None => bail!( "No block header found for hash: {}", block_hash.to_base58_check() ), }; // create request to ffi let request = HelpersPreapplyBlockRequest { protocol_rpc_request: ProtocolRpcRequest { chain_arg: chain_param.to_string(), block_header: block_header.header.as_ref().clone(), request: rpc_request, chain_id, }, predecessor_block_metadata_hash, predecessor_ops_metadata_hash, }; // TODO: retry? let response = env .tezos_readonly_api() .pool .get()? .api .helpers_preapply_block(request)?; Ok(serde_json::from_str(&response.body)?) } fn create_protocol_rpc_request( chain_param: &str, chain_id: ChainId, block_hash: BlockHash, rpc_request: RpcRequest, env: &RpcServiceEnvironment, ) -> Result<ProtocolRpcRequest, failure::Error> { let block_storage = BlockStorage::new(env.persistent_storage()); let block_header = match block_storage.get(&block_hash)? { Some(header) => header.header.as_ref().clone(), None => bail!( "No block header found for hash: {}", block_hash.to_base58_check() ), }; // create request to ffi Ok(ProtocolRpcRequest { chain_arg: chain_param.to_string(), block_header, request: rpc_request, chain_id, }) } pub(crate) struct ContextProtocolParam { pub protocol_hash: SupportedProtocol, pub constants_data: Vec<u8>, pub block_header: BlockHeaderWithHash, } #[derive(Debug, Fail)] pub enum ContextParamsError { #[fail(display = "Protocol not found in context for block: {}", _0)] NoProtocolForBlock(String), #[fail(display = "Protocol constants not found in context for block: {}", _0)] NoConstantsForBlock(String), #[fail(display = "Storage error occurred, reason: {}", reason)] StorageError { reason: storage::StorageError }, #[fail(display = "Context error occurred, reason: {}", reason)] ContextError { reason: TezedgeContextClientError }, #[fail(display = "Context constants, reason: {}", reason)] ContextConstantsDecodeError { reason: tezos_messages::protocol::ContextConstantsDecodeError, }, #[fail(display = "Unsupported protocol {}", protocol)] UnsupportedProtocolError { protocol: String }, #[fail(display = "Hash error {}", error)] HashError { error: FromBytesError }, } impl From<storage::StorageError> for ContextParamsError { fn from(error: storage::StorageError) -> Self { ContextParamsError::StorageError { reason: error } } } impl From<TezedgeContextClientError> for ContextParamsError { fn from(error: TezedgeContextClientError) -> Self { ContextParamsError::ContextError { reason: error } } } impl From<UnsupportedProtocolError> for ContextParamsError { fn from(error: UnsupportedProtocolError) -> Self { ContextParamsError::UnsupportedProtocolError { protocol: error.protocol, } } } impl From<tezos_messages::protocol::ContextConstantsDecodeError> for ContextParamsError { fn from(error: tezos_messages::protocol::ContextConstantsDecodeError) -> Self { ContextParamsError::ContextConstantsDecodeError { reason: error } } } impl From<FromBytesError> for ContextParamsError { fn from(error: FromBytesError) -> ContextParamsError { ContextParamsError::HashError { error } } } /// Get protocol and context constants as bytes from context list for desired block or level /// /// # Arguments /// /// * `block_hash` - [BlockHash] /// * `opt_level` - Optionaly input block level from block_id if is already known to prevent double code execution. /// * `list` - Context list handler. /// * `persistent_storage` - Persistent storage handler. /// * `state` - Current RPC collected state (head). pub(crate) fn get_context_protocol_params( block_hash: &BlockHash, env: &RpcServiceEnvironment, ) -> Result<ContextProtocolParam, ContextParamsError> { // TODO - TE-261: this will not work with Irmin right now, we should check that or // try to reimplement the missing parts on top of Irmin too. // if only_irmin { // return Err(ContextParamsError::UnsupportedProtocolError { // protocol: "only-supported-with-tezedge-context".to_string(), // }); // } // get block header let block_header = match BlockStorage::new(env.persistent_storage()).get(block_hash)? { Some(block) => block, None => { return Err(storage::StorageError::MissingKey { when: "get_context_protocol_params".into(), } .into()) } }; let protocol_hash: ProtocolHash; let constants: Vec<u8>; { let context = env.tezedge_context(); let context_hash = block_header.header.context(); if let Some(data) = context.get_key_from_history(&context_hash, context_key_owned!("protocol"))? { protocol_hash = ProtocolHash::try_from(data)?; } else { return Err(ContextParamsError::NoProtocolForBlock( block_hash.to_base58_check(), )); } if let Some(data) = context.get_key_from_history(&context_hash, context_key_owned!("data/v1/constants"))? { constants = data; } else { return Err(ContextParamsError::NoConstantsForBlock( block_hash.to_base58_check(), )); } }; Ok(ContextProtocolParam { protocol_hash: protocol_hash.try_into()?, constants_data: constants, block_header, }) }
33.386179
168
0.626486
23ab38c4e36a28d8cf8b89c3d5d0210ac8089fd1
590
kt
Kotlin
src/k_10_poo/ejemplo13/Principal.kt
Gusn8/KotlinStudyJam
1d24b475e84b88099036988402f9e072a8187535
[ "MIT" ]
null
null
null
src/k_10_poo/ejemplo13/Principal.kt
Gusn8/KotlinStudyJam
1d24b475e84b88099036988402f9e072a8187535
[ "MIT" ]
null
null
null
src/k_10_poo/ejemplo13/Principal.kt
Gusn8/KotlinStudyJam
1d24b475e84b88099036988402f9e072a8187535
[ "MIT" ]
2
2019-09-19T16:37:19.000Z
2019-10-01T07:27:58.000Z
package k_10_poo.ejemplo13 /** * @author Gustavo Lizárraga * @date 26/09/2019 * * Plantear una clase llamada Dado. Definir una propiedad llamada valor que * permita cargar un valor comprendido entre 1 y 6 si llega un valor que no * está comprendido en este rango se debe cargar un 1. * Definir dos métodos, uno que genere un número aleatorio entre 1 y 6 y otro que lo imprima. * Al constructor llega el valor inicial que debe tener el dado (tratar de enviarle el número 7) * * */ fun main() { val dado1 = Dado(7) dado1.imprimir() dado1.tirar() dado1.imprimir() }
29.5
96
0.711864
7d53a8c5be2a4a63c642560355d96f6120753dcb
195
html
HTML
flask/app/templates/show_image.html
Vivikar/bMRI_analyzer
23f362c94c19773a398fca53bf261396b0011b59
[ "MIT" ]
1
2019-12-09T15:20:54.000Z
2019-12-09T15:20:54.000Z
flask/app/templates/show_image.html
Vivikar/bMRI_analyzer
23f362c94c19773a398fca53bf261396b0011b59
[ "MIT" ]
2
2021-08-25T15:52:45.000Z
2022-02-10T01:07:45.000Z
flask/app/templates/show_image.html
Vivikar/bMRI_analyzer
23f362c94c19773a398fca53bf261396b0011b59
[ "MIT" ]
null
null
null
{% extends "base.html" %} {% block head %} <link rel="stylesheet" href="{{url_for('static', filename='styles/style.css')}}"> {% endblock %} {% block content %} <img src={{img}}/> {% endblock %}
39
116
0.6
9a225ea0ba64acc71eafa3710f1a236e168f856f
276
css
CSS
assets/css/style.css
iniryan/cucisepatu
45360d3c47330c83c4dc3d22487719bf7a4d9569
[ "MIT" ]
null
null
null
assets/css/style.css
iniryan/cucisepatu
45360d3c47330c83c4dc3d22487719bf7a4d9569
[ "MIT" ]
null
null
null
assets/css/style.css
iniryan/cucisepatu
45360d3c47330c83c4dc3d22487719bf7a4d9569
[ "MIT" ]
null
null
null
* { font-family: Montserrat; } .float-add { position: fixed; width: 60px; height: 60px; bottom: 80px; right: 40px; background-color: #25d366; color: #fff; border-radius: 50px; text-align: center; font-size: 30px; z-index: 100; } .my-float { margin-top: 16px; }
12.545455
27
0.652174
78262f6ebae44ecf2cb3ba221b349daf851deb84
397
kt
Kotlin
frontend/src/main/kotlin/de/uulm/se/couchedit/client/viewmodel/canvas/gef/visual/RootVisual.kt
sp-uulm/CouchEdit
595266c0bca8f2ee6ff633c4b45b91e5f3132cc4
[ "Apache-2.0" ]
null
null
null
frontend/src/main/kotlin/de/uulm/se/couchedit/client/viewmodel/canvas/gef/visual/RootVisual.kt
sp-uulm/CouchEdit
595266c0bca8f2ee6ff633c4b45b91e5f3132cc4
[ "Apache-2.0" ]
null
null
null
frontend/src/main/kotlin/de/uulm/se/couchedit/client/viewmodel/canvas/gef/visual/RootVisual.kt
sp-uulm/CouchEdit
595266c0bca8f2ee6ff633c4b45b91e5f3132cc4
[ "Apache-2.0" ]
null
null
null
package de.uulm.se.couchedit.client.viewmodel.canvas.gef.visual import javafx.scene.Group import javafx.scene.Node class RootVisual: Group(), SupportsChildren { override fun addChild(visual: Node, index: Int?) { index?.let { this.children.add(it, visual) } ?: this.children.add(visual) } override fun removeChild(visual: Node) { this.children.remove(visual) } }
26.466667
81
0.700252
d56faf0290e7e1d08d4c22d531621edcbebf3751
4,349
swift
Swift
WWCollapsibleFormExample/WWCollapsibleFormExample/AppDelegate.swift
werewolf2188/WWCollapsibleForm
85b9f0d29dc230d492b74f47118e2c583e210239
[ "MIT" ]
null
null
null
WWCollapsibleFormExample/WWCollapsibleFormExample/AppDelegate.swift
werewolf2188/WWCollapsibleForm
85b9f0d29dc230d492b74f47118e2c583e210239
[ "MIT" ]
null
null
null
WWCollapsibleFormExample/WWCollapsibleFormExample/AppDelegate.swift
werewolf2188/WWCollapsibleForm
85b9f0d29dc230d492b74f47118e2c583e210239
[ "MIT" ]
null
null
null
// // AppDelegate.swift // WWCollapsibleFormExample // // Created by Enrique Ricalde on 9/12/18. // Copyright © 2018 werewolf. All rights reserved. // import UIKit import Swinject import WWCollapsibleForm @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? let container: Container = { let defaultContainer = Container() defaultContainer.register(IUnitOfWork.self) { _ in WWCollapsibleFormExampleContext() }.inObjectScope(.container) defaultContainer.register(MenuProvider.self, factory: { r in let interactor : MenuInteractor = MenuInteractor() interactor.context = r.resolve(IUnitOfWork.self) return interactor }).inObjectScope(.graph) defaultContainer.register(MenuViewEventHandler.self, factory: { r in let presenter : MenuPresenter = MenuPresenter() let provider : MenuProvider? = r.resolve(MenuProvider.self) provider?.output = presenter presenter.menuProvider = provider return presenter }).inObjectScope(.graph) defaultContainer.register(ViewController.self) { r in let storyboard = UIStoryboard.init(name: "Main", bundle: Bundle(for: ViewController.self)) let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController let c = navigationController?.topViewController as! ViewController c.navigationItem.hidesBackButton = true let ev : MenuViewEventHandler? = r.resolve(MenuViewEventHandler.self) ev?.view = c c.eventHandler = ev return c } print("") return defaultContainer }() func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let window = UIWindow(frame: UIScreen.main.bounds) window.makeKeyAndVisible() self.window = window let storyboard = UIStoryboard.init(name: "Main", bundle: Bundle(for: ViewController.self)) let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController navigationController?.pushViewController(container.resolve(ViewController.self)!, animated: false) // Instantiate the root view controller with dependencies injected by the container. window.rootViewController = navigationController return true } func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }
46.763441
285
0.707289
54594eae683dbfedf8ff9956e20324e75ddbaebc
140,865
go
Go
x/mining/types/query.pb.go
stafihub/stafihub
0fe11cc2a39cd8ceca66eef89330b5720a8dd973
[ "Apache-2.0" ]
2
2022-03-19T17:15:02.000Z
2022-03-20T20:36:10.000Z
x/mining/types/query.pb.go
stafihub/stafihub
0fe11cc2a39cd8ceca66eef89330b5720a8dd973
[ "Apache-2.0" ]
null
null
null
x/mining/types/query.pb.go
stafihub/stafihub
0fe11cc2a39cd8ceca66eef89330b5720a8dd973
[ "Apache-2.0" ]
null
null
null
// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: mining/query.proto package types import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" io "io" math "math" math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryParamsRequest is request type for the Query/Params RPC method. type QueryParamsRequest struct { } func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{0} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse is response type for the Query/Params RPC method. type QueryParamsResponse struct { // params holds all the parameters of this module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{1} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo func (m *QueryParamsResponse) GetParams() Params { if m != nil { return m.Params } return Params{} } type QueryStakePoolInfoRequest struct { StakePoolIndex uint32 `protobuf:"varint,1,opt,name=stakePoolIndex,proto3" json:"stakePoolIndex,omitempty"` } func (m *QueryStakePoolInfoRequest) Reset() { *m = QueryStakePoolInfoRequest{} } func (m *QueryStakePoolInfoRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakePoolInfoRequest) ProtoMessage() {} func (*QueryStakePoolInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{2} } func (m *QueryStakePoolInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakePoolInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakePoolInfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakePoolInfoRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakePoolInfoRequest.Merge(m, src) } func (m *QueryStakePoolInfoRequest) XXX_Size() int { return m.Size() } func (m *QueryStakePoolInfoRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakePoolInfoRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStakePoolInfoRequest proto.InternalMessageInfo func (m *QueryStakePoolInfoRequest) GetStakePoolIndex() uint32 { if m != nil { return m.StakePoolIndex } return 0 } type QueryStakePoolInfoResponse struct { StakePool *StakePool `protobuf:"bytes,1,opt,name=stakePool,proto3" json:"stakePool,omitempty"` } func (m *QueryStakePoolInfoResponse) Reset() { *m = QueryStakePoolInfoResponse{} } func (m *QueryStakePoolInfoResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakePoolInfoResponse) ProtoMessage() {} func (*QueryStakePoolInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{3} } func (m *QueryStakePoolInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakePoolInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakePoolInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakePoolInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakePoolInfoResponse.Merge(m, src) } func (m *QueryStakePoolInfoResponse) XXX_Size() int { return m.Size() } func (m *QueryStakePoolInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakePoolInfoResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStakePoolInfoResponse proto.InternalMessageInfo func (m *QueryStakePoolInfoResponse) GetStakePool() *StakePool { if m != nil { return m.StakePool } return nil } type QueryStakeItemListRequest struct { StakePoolIndex uint32 `protobuf:"varint,1,opt,name=stakePoolIndex,proto3" json:"stakePoolIndex,omitempty"` } func (m *QueryStakeItemListRequest) Reset() { *m = QueryStakeItemListRequest{} } func (m *QueryStakeItemListRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakeItemListRequest) ProtoMessage() {} func (*QueryStakeItemListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{4} } func (m *QueryStakeItemListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeItemListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeItemListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeItemListRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeItemListRequest.Merge(m, src) } func (m *QueryStakeItemListRequest) XXX_Size() int { return m.Size() } func (m *QueryStakeItemListRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeItemListRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeItemListRequest proto.InternalMessageInfo func (m *QueryStakeItemListRequest) GetStakePoolIndex() uint32 { if m != nil { return m.StakePoolIndex } return 0 } type QueryStakeItemListResponse struct { StakeItemList []*StakeItem `protobuf:"bytes,1,rep,name=stakeItemList,proto3" json:"stakeItemList,omitempty"` } func (m *QueryStakeItemListResponse) Reset() { *m = QueryStakeItemListResponse{} } func (m *QueryStakeItemListResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakeItemListResponse) ProtoMessage() {} func (*QueryStakeItemListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{5} } func (m *QueryStakeItemListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeItemListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeItemListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeItemListResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeItemListResponse.Merge(m, src) } func (m *QueryStakeItemListResponse) XXX_Size() int { return m.Size() } func (m *QueryStakeItemListResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeItemListResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeItemListResponse proto.InternalMessageInfo func (m *QueryStakeItemListResponse) GetStakeItemList() []*StakeItem { if m != nil { return m.StakeItemList } return nil } type QueryStakeRewardRequest struct { StakeUserAddress string `protobuf:"bytes,1,opt,name=stakeUserAddress,proto3" json:"stakeUserAddress,omitempty"` StakePoolIndex uint32 `protobuf:"varint,2,opt,name=stakePoolIndex,proto3" json:"stakePoolIndex,omitempty"` StakeRecordIndex uint32 `protobuf:"varint,3,opt,name=stakeRecordIndex,proto3" json:"stakeRecordIndex,omitempty"` } func (m *QueryStakeRewardRequest) Reset() { *m = QueryStakeRewardRequest{} } func (m *QueryStakeRewardRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakeRewardRequest) ProtoMessage() {} func (*QueryStakeRewardRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{6} } func (m *QueryStakeRewardRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRewardRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRewardRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRewardRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRewardRequest.Merge(m, src) } func (m *QueryStakeRewardRequest) XXX_Size() int { return m.Size() } func (m *QueryStakeRewardRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRewardRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRewardRequest proto.InternalMessageInfo func (m *QueryStakeRewardRequest) GetStakeUserAddress() string { if m != nil { return m.StakeUserAddress } return "" } func (m *QueryStakeRewardRequest) GetStakePoolIndex() uint32 { if m != nil { return m.StakePoolIndex } return 0 } func (m *QueryStakeRewardRequest) GetStakeRecordIndex() uint32 { if m != nil { return m.StakeRecordIndex } return 0 } type QueryStakeRewardResponse struct { RewardTokens []github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,1,rep,name=rewardTokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"rewardTokens"` } func (m *QueryStakeRewardResponse) Reset() { *m = QueryStakeRewardResponse{} } func (m *QueryStakeRewardResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakeRewardResponse) ProtoMessage() {} func (*QueryStakeRewardResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{7} } func (m *QueryStakeRewardResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRewardResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRewardResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRewardResponse.Merge(m, src) } func (m *QueryStakeRewardResponse) XXX_Size() int { return m.Size() } func (m *QueryStakeRewardResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRewardResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRewardResponse proto.InternalMessageInfo type QueryStakeRecordCountRequest struct { UserAddress string `protobuf:"bytes,1,opt,name=userAddress,proto3" json:"userAddress,omitempty"` StakePoolIndex uint32 `protobuf:"varint,2,opt,name=stakePoolIndex,proto3" json:"stakePoolIndex,omitempty"` } func (m *QueryStakeRecordCountRequest) Reset() { *m = QueryStakeRecordCountRequest{} } func (m *QueryStakeRecordCountRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakeRecordCountRequest) ProtoMessage() {} func (*QueryStakeRecordCountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{8} } func (m *QueryStakeRecordCountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRecordCountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRecordCountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRecordCountRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRecordCountRequest.Merge(m, src) } func (m *QueryStakeRecordCountRequest) XXX_Size() int { return m.Size() } func (m *QueryStakeRecordCountRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRecordCountRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRecordCountRequest proto.InternalMessageInfo func (m *QueryStakeRecordCountRequest) GetUserAddress() string { if m != nil { return m.UserAddress } return "" } func (m *QueryStakeRecordCountRequest) GetStakePoolIndex() uint32 { if m != nil { return m.StakePoolIndex } return 0 } type QueryStakeRecordCountResponse struct { Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` } func (m *QueryStakeRecordCountResponse) Reset() { *m = QueryStakeRecordCountResponse{} } func (m *QueryStakeRecordCountResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakeRecordCountResponse) ProtoMessage() {} func (*QueryStakeRecordCountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{9} } func (m *QueryStakeRecordCountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRecordCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRecordCountResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRecordCountResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRecordCountResponse.Merge(m, src) } func (m *QueryStakeRecordCountResponse) XXX_Size() int { return m.Size() } func (m *QueryStakeRecordCountResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRecordCountResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRecordCountResponse proto.InternalMessageInfo func (m *QueryStakeRecordCountResponse) GetCount() uint32 { if m != nil { return m.Count } return 0 } type QueryStakeRecordRequest struct { UserAddress string `protobuf:"bytes,1,opt,name=userAddress,proto3" json:"userAddress,omitempty"` StakePoolIndex uint32 `protobuf:"varint,2,opt,name=stakePoolIndex,proto3" json:"stakePoolIndex,omitempty"` StakeRecordIndex uint32 `protobuf:"varint,3,opt,name=stakeRecordIndex,proto3" json:"stakeRecordIndex,omitempty"` } func (m *QueryStakeRecordRequest) Reset() { *m = QueryStakeRecordRequest{} } func (m *QueryStakeRecordRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakeRecordRequest) ProtoMessage() {} func (*QueryStakeRecordRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{10} } func (m *QueryStakeRecordRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRecordRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRecordRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRecordRequest.Merge(m, src) } func (m *QueryStakeRecordRequest) XXX_Size() int { return m.Size() } func (m *QueryStakeRecordRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRecordRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRecordRequest proto.InternalMessageInfo func (m *QueryStakeRecordRequest) GetUserAddress() string { if m != nil { return m.UserAddress } return "" } func (m *QueryStakeRecordRequest) GetStakePoolIndex() uint32 { if m != nil { return m.StakePoolIndex } return 0 } func (m *QueryStakeRecordRequest) GetStakeRecordIndex() uint32 { if m != nil { return m.StakeRecordIndex } return 0 } type QueryStakeRecordResponse struct { StakeRecord *UserStakeRecord `protobuf:"bytes,1,opt,name=stakeRecord,proto3" json:"stakeRecord,omitempty"` } func (m *QueryStakeRecordResponse) Reset() { *m = QueryStakeRecordResponse{} } func (m *QueryStakeRecordResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakeRecordResponse) ProtoMessage() {} func (*QueryStakeRecordResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{11} } func (m *QueryStakeRecordResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRecordResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRecordResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRecordResponse.Merge(m, src) } func (m *QueryStakeRecordResponse) XXX_Size() int { return m.Size() } func (m *QueryStakeRecordResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRecordResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRecordResponse proto.InternalMessageInfo func (m *QueryStakeRecordResponse) GetStakeRecord() *UserStakeRecord { if m != nil { return m.StakeRecord } return nil } type QueryStakeRecordListRequest struct { UserAddress string `protobuf:"bytes,1,opt,name=userAddress,proto3" json:"userAddress,omitempty"` StakePoolIndex uint32 `protobuf:"varint,2,opt,name=stakePoolIndex,proto3" json:"stakePoolIndex,omitempty"` } func (m *QueryStakeRecordListRequest) Reset() { *m = QueryStakeRecordListRequest{} } func (m *QueryStakeRecordListRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakeRecordListRequest) ProtoMessage() {} func (*QueryStakeRecordListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{12} } func (m *QueryStakeRecordListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRecordListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRecordListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRecordListRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRecordListRequest.Merge(m, src) } func (m *QueryStakeRecordListRequest) XXX_Size() int { return m.Size() } func (m *QueryStakeRecordListRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRecordListRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRecordListRequest proto.InternalMessageInfo func (m *QueryStakeRecordListRequest) GetUserAddress() string { if m != nil { return m.UserAddress } return "" } func (m *QueryStakeRecordListRequest) GetStakePoolIndex() uint32 { if m != nil { return m.StakePoolIndex } return 0 } type QueryStakeRecordListResponse struct { StakeRecordList []*UserStakeRecord `protobuf:"bytes,1,rep,name=stakeRecordList,proto3" json:"stakeRecordList,omitempty"` } func (m *QueryStakeRecordListResponse) Reset() { *m = QueryStakeRecordListResponse{} } func (m *QueryStakeRecordListResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakeRecordListResponse) ProtoMessage() {} func (*QueryStakeRecordListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{13} } func (m *QueryStakeRecordListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakeRecordListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakeRecordListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakeRecordListResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakeRecordListResponse.Merge(m, src) } func (m *QueryStakeRecordListResponse) XXX_Size() int { return m.Size() } func (m *QueryStakeRecordListResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakeRecordListResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStakeRecordListResponse proto.InternalMessageInfo func (m *QueryStakeRecordListResponse) GetStakeRecordList() []*UserStakeRecord { if m != nil { return m.StakeRecordList } return nil } type QueryStakePoolListRequest struct { } func (m *QueryStakePoolListRequest) Reset() { *m = QueryStakePoolListRequest{} } func (m *QueryStakePoolListRequest) String() string { return proto.CompactTextString(m) } func (*QueryStakePoolListRequest) ProtoMessage() {} func (*QueryStakePoolListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{14} } func (m *QueryStakePoolListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakePoolListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakePoolListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakePoolListRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakePoolListRequest.Merge(m, src) } func (m *QueryStakePoolListRequest) XXX_Size() int { return m.Size() } func (m *QueryStakePoolListRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakePoolListRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryStakePoolListRequest proto.InternalMessageInfo type QueryStakePoolListResponse struct { StakePoolList []*StakePool `protobuf:"bytes,1,rep,name=stakePoolList,proto3" json:"stakePoolList,omitempty"` } func (m *QueryStakePoolListResponse) Reset() { *m = QueryStakePoolListResponse{} } func (m *QueryStakePoolListResponse) String() string { return proto.CompactTextString(m) } func (*QueryStakePoolListResponse) ProtoMessage() {} func (*QueryStakePoolListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{15} } func (m *QueryStakePoolListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryStakePoolListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryStakePoolListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryStakePoolListResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryStakePoolListResponse.Merge(m, src) } func (m *QueryStakePoolListResponse) XXX_Size() int { return m.Size() } func (m *QueryStakePoolListResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryStakePoolListResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryStakePoolListResponse proto.InternalMessageInfo func (m *QueryStakePoolListResponse) GetStakePoolList() []*StakePool { if m != nil { return m.StakePoolList } return nil } type QueryMiningProviderListRequest struct { } func (m *QueryMiningProviderListRequest) Reset() { *m = QueryMiningProviderListRequest{} } func (m *QueryMiningProviderListRequest) String() string { return proto.CompactTextString(m) } func (*QueryMiningProviderListRequest) ProtoMessage() {} func (*QueryMiningProviderListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{16} } func (m *QueryMiningProviderListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryMiningProviderListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMiningProviderListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryMiningProviderListRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMiningProviderListRequest.Merge(m, src) } func (m *QueryMiningProviderListRequest) XXX_Size() int { return m.Size() } func (m *QueryMiningProviderListRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryMiningProviderListRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryMiningProviderListRequest proto.InternalMessageInfo type QueryMiningProviderListResponse struct { MiningProviderList []string `protobuf:"bytes,1,rep,name=miningProviderList,proto3" json:"miningProviderList,omitempty"` } func (m *QueryMiningProviderListResponse) Reset() { *m = QueryMiningProviderListResponse{} } func (m *QueryMiningProviderListResponse) String() string { return proto.CompactTextString(m) } func (*QueryMiningProviderListResponse) ProtoMessage() {} func (*QueryMiningProviderListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{17} } func (m *QueryMiningProviderListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryMiningProviderListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMiningProviderListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryMiningProviderListResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMiningProviderListResponse.Merge(m, src) } func (m *QueryMiningProviderListResponse) XXX_Size() int { return m.Size() } func (m *QueryMiningProviderListResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryMiningProviderListResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryMiningProviderListResponse proto.InternalMessageInfo func (m *QueryMiningProviderListResponse) GetMiningProviderList() []string { if m != nil { return m.MiningProviderList } return nil } type QueryRewardTokenListRequest struct { } func (m *QueryRewardTokenListRequest) Reset() { *m = QueryRewardTokenListRequest{} } func (m *QueryRewardTokenListRequest) String() string { return proto.CompactTextString(m) } func (*QueryRewardTokenListRequest) ProtoMessage() {} func (*QueryRewardTokenListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{18} } func (m *QueryRewardTokenListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryRewardTokenListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRewardTokenListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryRewardTokenListRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRewardTokenListRequest.Merge(m, src) } func (m *QueryRewardTokenListRequest) XXX_Size() int { return m.Size() } func (m *QueryRewardTokenListRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryRewardTokenListRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryRewardTokenListRequest proto.InternalMessageInfo type QueryRewardTokenListResponse struct { RewardTokenList []*RewardToken `protobuf:"bytes,1,rep,name=rewardTokenList,proto3" json:"rewardTokenList,omitempty"` } func (m *QueryRewardTokenListResponse) Reset() { *m = QueryRewardTokenListResponse{} } func (m *QueryRewardTokenListResponse) String() string { return proto.CompactTextString(m) } func (*QueryRewardTokenListResponse) ProtoMessage() {} func (*QueryRewardTokenListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{19} } func (m *QueryRewardTokenListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryRewardTokenListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRewardTokenListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryRewardTokenListResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRewardTokenListResponse.Merge(m, src) } func (m *QueryRewardTokenListResponse) XXX_Size() int { return m.Size() } func (m *QueryRewardTokenListResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryRewardTokenListResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryRewardTokenListResponse proto.InternalMessageInfo func (m *QueryRewardTokenListResponse) GetRewardTokenList() []*RewardToken { if m != nil { return m.RewardTokenList } return nil } type QueryMaxRewardPoolNumberRequest struct { } func (m *QueryMaxRewardPoolNumberRequest) Reset() { *m = QueryMaxRewardPoolNumberRequest{} } func (m *QueryMaxRewardPoolNumberRequest) String() string { return proto.CompactTextString(m) } func (*QueryMaxRewardPoolNumberRequest) ProtoMessage() {} func (*QueryMaxRewardPoolNumberRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{20} } func (m *QueryMaxRewardPoolNumberRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryMaxRewardPoolNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMaxRewardPoolNumberRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryMaxRewardPoolNumberRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMaxRewardPoolNumberRequest.Merge(m, src) } func (m *QueryMaxRewardPoolNumberRequest) XXX_Size() int { return m.Size() } func (m *QueryMaxRewardPoolNumberRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryMaxRewardPoolNumberRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryMaxRewardPoolNumberRequest proto.InternalMessageInfo type QueryMaxRewardPoolNumberResponse struct { Number uint32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` } func (m *QueryMaxRewardPoolNumberResponse) Reset() { *m = QueryMaxRewardPoolNumberResponse{} } func (m *QueryMaxRewardPoolNumberResponse) String() string { return proto.CompactTextString(m) } func (*QueryMaxRewardPoolNumberResponse) ProtoMessage() {} func (*QueryMaxRewardPoolNumberResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{21} } func (m *QueryMaxRewardPoolNumberResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryMaxRewardPoolNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMaxRewardPoolNumberResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryMaxRewardPoolNumberResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMaxRewardPoolNumberResponse.Merge(m, src) } func (m *QueryMaxRewardPoolNumberResponse) XXX_Size() int { return m.Size() } func (m *QueryMaxRewardPoolNumberResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryMaxRewardPoolNumberResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryMaxRewardPoolNumberResponse proto.InternalMessageInfo func (m *QueryMaxRewardPoolNumberResponse) GetNumber() uint32 { if m != nil { return m.Number } return 0 } type QueryMaxStakeItemNumberRequest struct { } func (m *QueryMaxStakeItemNumberRequest) Reset() { *m = QueryMaxStakeItemNumberRequest{} } func (m *QueryMaxStakeItemNumberRequest) String() string { return proto.CompactTextString(m) } func (*QueryMaxStakeItemNumberRequest) ProtoMessage() {} func (*QueryMaxStakeItemNumberRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{22} } func (m *QueryMaxStakeItemNumberRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryMaxStakeItemNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMaxStakeItemNumberRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryMaxStakeItemNumberRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMaxStakeItemNumberRequest.Merge(m, src) } func (m *QueryMaxStakeItemNumberRequest) XXX_Size() int { return m.Size() } func (m *QueryMaxStakeItemNumberRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryMaxStakeItemNumberRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryMaxStakeItemNumberRequest proto.InternalMessageInfo type QueryMaxStakeItemNumberResponse struct { Number uint32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` } func (m *QueryMaxStakeItemNumberResponse) Reset() { *m = QueryMaxStakeItemNumberResponse{} } func (m *QueryMaxStakeItemNumberResponse) String() string { return proto.CompactTextString(m) } func (*QueryMaxStakeItemNumberResponse) ProtoMessage() {} func (*QueryMaxStakeItemNumberResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{23} } func (m *QueryMaxStakeItemNumberResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryMaxStakeItemNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMaxStakeItemNumberResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryMaxStakeItemNumberResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMaxStakeItemNumberResponse.Merge(m, src) } func (m *QueryMaxStakeItemNumberResponse) XXX_Size() int { return m.Size() } func (m *QueryMaxStakeItemNumberResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryMaxStakeItemNumberResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryMaxStakeItemNumberResponse proto.InternalMessageInfo func (m *QueryMaxStakeItemNumberResponse) GetNumber() uint32 { if m != nil { return m.Number } return 0 } type QueryProviderSwitchRequest struct { } func (m *QueryProviderSwitchRequest) Reset() { *m = QueryProviderSwitchRequest{} } func (m *QueryProviderSwitchRequest) String() string { return proto.CompactTextString(m) } func (*QueryProviderSwitchRequest) ProtoMessage() {} func (*QueryProviderSwitchRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{24} } func (m *QueryProviderSwitchRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryProviderSwitchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryProviderSwitchRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryProviderSwitchRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryProviderSwitchRequest.Merge(m, src) } func (m *QueryProviderSwitchRequest) XXX_Size() int { return m.Size() } func (m *QueryProviderSwitchRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryProviderSwitchRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryProviderSwitchRequest proto.InternalMessageInfo type QueryProviderSwitchResponse struct { ProviderSwitch bool `protobuf:"varint,1,opt,name=providerSwitch,proto3" json:"providerSwitch,omitempty"` } func (m *QueryProviderSwitchResponse) Reset() { *m = QueryProviderSwitchResponse{} } func (m *QueryProviderSwitchResponse) String() string { return proto.CompactTextString(m) } func (*QueryProviderSwitchResponse) ProtoMessage() {} func (*QueryProviderSwitchResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5968127a041da29a, []int{25} } func (m *QueryProviderSwitchResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *QueryProviderSwitchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryProviderSwitchResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } func (m *QueryProviderSwitchResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryProviderSwitchResponse.Merge(m, src) } func (m *QueryProviderSwitchResponse) XXX_Size() int { return m.Size() } func (m *QueryProviderSwitchResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryProviderSwitchResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryProviderSwitchResponse proto.InternalMessageInfo func (m *QueryProviderSwitchResponse) GetProviderSwitch() bool { if m != nil { return m.ProviderSwitch } return false } func init() { proto.RegisterType((*QueryParamsRequest)(nil), "stafihub.stafihub.mining.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "stafihub.stafihub.mining.QueryParamsResponse") proto.RegisterType((*QueryStakePoolInfoRequest)(nil), "stafihub.stafihub.mining.QueryStakePoolInfoRequest") proto.RegisterType((*QueryStakePoolInfoResponse)(nil), "stafihub.stafihub.mining.QueryStakePoolInfoResponse") proto.RegisterType((*QueryStakeItemListRequest)(nil), "stafihub.stafihub.mining.QueryStakeItemListRequest") proto.RegisterType((*QueryStakeItemListResponse)(nil), "stafihub.stafihub.mining.QueryStakeItemListResponse") proto.RegisterType((*QueryStakeRewardRequest)(nil), "stafihub.stafihub.mining.QueryStakeRewardRequest") proto.RegisterType((*QueryStakeRewardResponse)(nil), "stafihub.stafihub.mining.QueryStakeRewardResponse") proto.RegisterType((*QueryStakeRecordCountRequest)(nil), "stafihub.stafihub.mining.QueryStakeRecordCountRequest") proto.RegisterType((*QueryStakeRecordCountResponse)(nil), "stafihub.stafihub.mining.QueryStakeRecordCountResponse") proto.RegisterType((*QueryStakeRecordRequest)(nil), "stafihub.stafihub.mining.QueryStakeRecordRequest") proto.RegisterType((*QueryStakeRecordResponse)(nil), "stafihub.stafihub.mining.QueryStakeRecordResponse") proto.RegisterType((*QueryStakeRecordListRequest)(nil), "stafihub.stafihub.mining.QueryStakeRecordListRequest") proto.RegisterType((*QueryStakeRecordListResponse)(nil), "stafihub.stafihub.mining.QueryStakeRecordListResponse") proto.RegisterType((*QueryStakePoolListRequest)(nil), "stafihub.stafihub.mining.QueryStakePoolListRequest") proto.RegisterType((*QueryStakePoolListResponse)(nil), "stafihub.stafihub.mining.QueryStakePoolListResponse") proto.RegisterType((*QueryMiningProviderListRequest)(nil), "stafihub.stafihub.mining.QueryMiningProviderListRequest") proto.RegisterType((*QueryMiningProviderListResponse)(nil), "stafihub.stafihub.mining.QueryMiningProviderListResponse") proto.RegisterType((*QueryRewardTokenListRequest)(nil), "stafihub.stafihub.mining.QueryRewardTokenListRequest") proto.RegisterType((*QueryRewardTokenListResponse)(nil), "stafihub.stafihub.mining.QueryRewardTokenListResponse") proto.RegisterType((*QueryMaxRewardPoolNumberRequest)(nil), "stafihub.stafihub.mining.QueryMaxRewardPoolNumberRequest") proto.RegisterType((*QueryMaxRewardPoolNumberResponse)(nil), "stafihub.stafihub.mining.QueryMaxRewardPoolNumberResponse") proto.RegisterType((*QueryMaxStakeItemNumberRequest)(nil), "stafihub.stafihub.mining.QueryMaxStakeItemNumberRequest") proto.RegisterType((*QueryMaxStakeItemNumberResponse)(nil), "stafihub.stafihub.mining.QueryMaxStakeItemNumberResponse") proto.RegisterType((*QueryProviderSwitchRequest)(nil), "stafihub.stafihub.mining.QueryProviderSwitchRequest") proto.RegisterType((*QueryProviderSwitchResponse)(nil), "stafihub.stafihub.mining.QueryProviderSwitchResponse") } func init() { proto.RegisterFile("mining/query.proto", fileDescriptor_5968127a041da29a) } var fileDescriptor_5968127a041da29a = []byte{ // 1207 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4f, 0x6f, 0xdc, 0x44, 0x14, 0x8f, 0x5b, 0x1a, 0x91, 0x09, 0x49, 0xaa, 0x49, 0x04, 0xa9, 0x9b, 0x6e, 0x96, 0x41, 0x94, 0xb6, 0x21, 0x76, 0x93, 0x90, 0xb4, 0x89, 0x10, 0x52, 0x13, 0xf5, 0x10, 0xda, 0x42, 0xea, 0x50, 0x09, 0x55, 0x42, 0x8b, 0xb3, 0x3b, 0x71, 0xac, 0xec, 0x7a, 0xb6, 0x1e, 0x6f, 0xbb, 0x55, 0x95, 0x0b, 0x47, 0x2e, 0x45, 0xe2, 0xc4, 0x87, 0xa8, 0xc4, 0x85, 0x2b, 0x12, 0x1c, 0x50, 0x8f, 0x95, 0x40, 0xa8, 0x02, 0xa9, 0xaa, 0x12, 0x3e, 0x08, 0xf2, 0xcc, 0xf3, 0x7a, 0x6c, 0xaf, 0x63, 0x6f, 0xd4, 0x53, 0x76, 0xdf, 0xbc, 0x3f, 0xbf, 0xdf, 0x7b, 0x6f, 0xde, 0xbc, 0x0d, 0xc2, 0x2d, 0xd7, 0x73, 0x3d, 0xc7, 0x7c, 0xd0, 0xa1, 0xfe, 0x63, 0xa3, 0xed, 0xb3, 0x80, 0xe1, 0x69, 0x1e, 0xd8, 0xbb, 0xee, 0x5e, 0x67, 0xc7, 0xe8, 0x7d, 0x90, 0x5a, 0xfa, 0x94, 0xc3, 0x1c, 0x26, 0x94, 0xcc, 0xf0, 0x93, 0xd4, 0xd7, 0x67, 0x1c, 0xc6, 0x9c, 0x26, 0x35, 0xed, 0xb6, 0x6b, 0xda, 0x9e, 0xc7, 0x02, 0x3b, 0x70, 0x99, 0xc7, 0xe1, 0xf4, 0x4a, 0x9d, 0xf1, 0x16, 0xe3, 0xe6, 0x8e, 0xcd, 0xa9, 0x0c, 0x63, 0x3e, 0x5c, 0xd8, 0xa1, 0x81, 0xbd, 0x60, 0xb6, 0x6d, 0xc7, 0xf5, 0x84, 0x32, 0xe8, 0x4e, 0x02, 0x9a, 0xb6, 0xed, 0xdb, 0x2d, 0x9e, 0x12, 0xb6, 0x58, 0x83, 0x36, 0x23, 0x61, 0x45, 0xf5, 0x1a, 0xf9, 0xab, 0x33, 0x17, 0x3c, 0x91, 0x29, 0x84, 0xef, 0x86, 0xb1, 0xb6, 0x84, 0x27, 0x8b, 0x3e, 0xe8, 0x50, 0x1e, 0x90, 0x7b, 0x68, 0x32, 0x21, 0xe5, 0x6d, 0xe6, 0x71, 0x8a, 0x3f, 0x43, 0xc3, 0x32, 0xe2, 0xb4, 0x56, 0xd5, 0x2e, 0x8d, 0x2e, 0x56, 0x8d, 0xbc, 0x0c, 0x18, 0xd2, 0x72, 0xfd, 0xad, 0xe7, 0xaf, 0x66, 0x87, 0x2c, 0xb0, 0x22, 0x1b, 0xe8, 0x9c, 0x70, 0xbb, 0x1d, 0xd8, 0xfb, 0x74, 0x8b, 0xb1, 0xe6, 0xa6, 0xb7, 0xcb, 0x20, 0x26, 0xbe, 0x88, 0xc6, 0x79, 0x2c, 0x6f, 0xd0, 0xae, 0x08, 0x32, 0x66, 0xa5, 0xa4, 0xa4, 0x86, 0xf4, 0x7e, 0x4e, 0x00, 0xe2, 0x0d, 0x34, 0xd2, 0xd3, 0x07, 0x94, 0x1f, 0xe4, 0xa3, 0xec, 0xf9, 0xb0, 0x62, 0xab, 0x24, 0xca, 0xcd, 0x80, 0xb6, 0x6e, 0xbb, 0x3c, 0x18, 0x14, 0xa5, 0xa3, 0xa2, 0x8c, 0x9d, 0x00, 0xca, 0x4d, 0x34, 0xc6, 0xd5, 0x83, 0x69, 0xad, 0x7a, 0xba, 0x04, 0xd2, 0x50, 0xdd, 0x4a, 0x5a, 0x92, 0x9f, 0x34, 0xf4, 0x5e, 0x1c, 0xc9, 0xa2, 0x8f, 0x6c, 0xbf, 0x11, 0x81, 0xbd, 0x82, 0xce, 0x0a, 0xe5, 0x7b, 0x9c, 0xfa, 0x37, 0x1a, 0x0d, 0x9f, 0x72, 0x59, 0xb9, 0x11, 0x2b, 0x23, 0xef, 0x43, 0xec, 0x54, 0x3f, 0x62, 0x3d, 0x9f, 0x16, 0xad, 0x33, 0xbf, 0x21, 0x35, 0x4f, 0x0b, 0xcd, 0x8c, 0x9c, 0x7c, 0xaf, 0xa1, 0xe9, 0x2c, 0x36, 0xc8, 0x81, 0x87, 0xde, 0xf1, 0x85, 0xe4, 0x2b, 0xb6, 0x4f, 0x3d, 0x0e, 0x29, 0x38, 0x67, 0xc8, 0x86, 0x35, 0xc2, 0x86, 0x35, 0xa0, 0x61, 0x8d, 0x0d, 0xe6, 0x7a, 0xeb, 0x66, 0xd8, 0x4b, 0xff, 0xbc, 0x9a, 0xfd, 0xc8, 0x71, 0x83, 0x30, 0x33, 0x75, 0xd6, 0x32, 0xa1, 0xbb, 0xe5, 0x9f, 0x79, 0xde, 0xd8, 0x37, 0x83, 0xc7, 0x6d, 0xca, 0x85, 0x81, 0x95, 0xf0, 0x4f, 0xf6, 0xd0, 0x8c, 0x8a, 0x25, 0x44, 0xb9, 0xc1, 0x3a, 0x5e, 0xaf, 0xb2, 0x55, 0x34, 0xda, 0xc9, 0xe4, 0x49, 0x15, 0x95, 0x4d, 0x11, 0x59, 0x46, 0x17, 0x72, 0x22, 0x01, 0xf5, 0x29, 0x74, 0xa6, 0x1e, 0x0a, 0xa0, 0x77, 0xe4, 0x17, 0xf2, 0x34, 0x55, 0xc9, 0xd0, 0xee, 0x8d, 0x83, 0x1b, 0xa8, 0x7e, 0x4e, 0xb2, 0x7c, 0x12, 0x10, 0x70, 0xb8, 0x85, 0x46, 0x15, 0x7d, 0xb8, 0x6a, 0x97, 0xf3, 0x1b, 0x38, 0xec, 0x35, 0xd5, 0x8f, 0x6a, 0x4d, 0x1c, 0x74, 0x3e, 0x1d, 0x48, 0xbd, 0x74, 0x6f, 0xae, 0x34, 0x3c, 0xdb, 0x04, 0x89, 0x8b, 0xb9, 0x8d, 0x26, 0x78, 0xf2, 0x08, 0xfa, 0x72, 0x00, 0x66, 0x69, 0x0f, 0xe4, 0x7c, 0x7a, 0xec, 0x29, 0xdc, 0x92, 0x83, 0x22, 0x3e, 0x4c, 0x0d, 0x8a, 0xe8, 0xa0, 0xe4, 0xa0, 0x10, 0x23, 0x2d, 0x69, 0x49, 0xaa, 0xa8, 0x22, 0x02, 0xdd, 0x11, 0x7a, 0x5b, 0x3e, 0x7b, 0xe8, 0x36, 0xa8, 0xaf, 0x42, 0xb9, 0x8b, 0x66, 0x73, 0x35, 0x00, 0x8f, 0x11, 0x3d, 0x84, 0xea, 0xa9, 0x00, 0x35, 0x62, 0xf5, 0x39, 0x21, 0x17, 0xa0, 0xb0, 0x56, 0x7c, 0x13, 0xd5, 0x88, 0x0c, 0xca, 0x91, 0x39, 0x86, 0x70, 0x5f, 0xa2, 0x09, 0x3f, 0x79, 0x04, 0x09, 0xf8, 0x30, 0x3f, 0x01, 0x8a, 0x2f, 0x2b, 0x6d, 0x4d, 0xde, 0x8f, 0x28, 0xda, 0x5d, 0xa9, 0x17, 0xa6, 0xe7, 0x8b, 0x4e, 0x6b, 0x87, 0xfa, 0x11, 0xa6, 0x35, 0x54, 0xcd, 0x57, 0x01, 0x5c, 0xef, 0xa2, 0x61, 0x4f, 0x48, 0xe0, 0x06, 0xc3, 0xb7, 0x38, 0xc7, 0x76, 0xb7, 0x37, 0xb0, 0x93, 0xde, 0x57, 0x63, 0x00, 0x19, 0x8d, 0x02, 0xe7, 0x33, 0xd0, 0x29, 0x51, 0x82, 0xb7, 0x1f, 0xb9, 0x41, 0x7d, 0x2f, 0x72, 0x7c, 0x13, 0x32, 0x9d, 0x3e, 0x05, 0xa7, 0x17, 0xd1, 0x78, 0x3b, 0x71, 0x22, 0x9c, 0xbf, 0x6d, 0xa5, 0xa4, 0x8b, 0xaf, 0x27, 0xd1, 0x19, 0xe1, 0x07, 0x3f, 0xd5, 0xd0, 0xb0, 0x7c, 0xc5, 0xf1, 0xc7, 0xf9, 0xd9, 0xce, 0x2e, 0x0f, 0xfa, 0x7c, 0x49, 0x6d, 0x89, 0x8c, 0x5c, 0xfa, 0xee, 0xcf, 0xff, 0x7e, 0x3c, 0x45, 0x70, 0xd5, 0x8c, 0xb4, 0xe3, 0x0f, 0x89, 0x35, 0x07, 0xff, 0xaa, 0xa1, 0xb1, 0xc4, 0xab, 0x8f, 0x97, 0x0a, 0x42, 0xf5, 0x5b, 0x34, 0xf4, 0x4f, 0x06, 0x33, 0x02, 0x98, 0xeb, 0x02, 0xe6, 0xa7, 0x78, 0x2d, 0x1f, 0xa6, 0xb8, 0x6f, 0xb5, 0x36, 0x63, 0xcd, 0x9a, 0xeb, 0xed, 0x32, 0xf3, 0x49, 0x72, 0xf8, 0x1c, 0xe0, 0x67, 0x11, 0x81, 0xe8, 0xf5, 0x2e, 0x47, 0x20, 0xb5, 0x83, 0x94, 0x23, 0x90, 0xde, 0x39, 0xc8, 0x82, 0x20, 0x30, 0x87, 0x2f, 0x17, 0x11, 0x70, 0x03, 0xda, 0xaa, 0x35, 0x43, 0x74, 0xff, 0x6a, 0x68, 0x54, 0x79, 0xba, 0xf1, 0x42, 0x99, 0xc0, 0x89, 0x15, 0x44, 0x5f, 0x1c, 0xc4, 0x04, 0x90, 0x52, 0x81, 0xb4, 0x86, 0xbf, 0x29, 0x42, 0x2a, 0x6f, 0x37, 0xe4, 0x59, 0x59, 0x66, 0x0e, 0x32, 0xa9, 0x07, 0x81, 0xf2, 0xb8, 0x1d, 0xe0, 0x97, 0x1a, 0x3a, 0x9b, 0x7e, 0xa2, 0xf1, 0x4a, 0x39, 0xbc, 0xe9, 0xed, 0x41, 0xbf, 0x36, 0xb0, 0x1d, 0x90, 0xdd, 0x16, 0x64, 0xef, 0xe0, 0x5b, 0xc5, 0x64, 0x43, 0xe3, 0x9a, 0xd8, 0x15, 0xcc, 0x27, 0x9d, 0xe3, 0xd8, 0xe2, 0xbf, 0xe3, 0xc2, 0x85, 0x46, 0x65, 0x0b, 0xa7, 0x6c, 0x1c, 0x65, 0x0b, 0xa7, 0xee, 0x04, 0xe4, 0x5b, 0xc1, 0xe5, 0x3e, 0xfe, 0xba, 0x1c, 0x97, 0x02, 0x16, 0xfd, 0x6a, 0xf6, 0x97, 0x86, 0x26, 0x52, 0x6f, 0x37, 0x5e, 0x2e, 0x8f, 0x54, 0xbd, 0x45, 0x2b, 0x83, 0x9a, 0x01, 0x49, 0x4b, 0x90, 0xbc, 0x8d, 0x3f, 0x2f, 0x59, 0xb0, 0xf0, 0x26, 0x15, 0xd5, 0xeb, 0x99, 0x3a, 0xd9, 0xca, 0x0f, 0x86, 0xd4, 0x2e, 0x51, 0x7e, 0xb2, 0x9d, 0x6c, 0x30, 0x88, 0xc9, 0x26, 0x06, 0xc3, 0x6f, 0x1a, 0xc2, 0xd9, 0x2d, 0x01, 0x5f, 0x2f, 0x88, 0x9f, 0xbb, 0x7a, 0xe8, 0xab, 0x27, 0xb0, 0x04, 0xf8, 0x2b, 0x02, 0xfe, 0x55, 0x6c, 0xe4, 0xc3, 0x97, 0x7f, 0x6a, 0xd1, 0x53, 0x27, 0x39, 0xfc, 0xa2, 0xa1, 0x89, 0xd4, 0xde, 0x51, 0xd8, 0x4a, 0xfd, 0xd7, 0x98, 0xc2, 0x56, 0xca, 0x59, 0x6f, 0xc8, 0x92, 0x80, 0x3e, 0x8f, 0xe7, 0xf2, 0xa1, 0xcb, 0x11, 0x57, 0x0b, 0x42, 0x5b, 0x89, 0xfb, 0x0f, 0x0d, 0x4d, 0xf6, 0xd9, 0x4d, 0x70, 0x61, 0x0a, 0x73, 0x57, 0x1e, 0x7d, 0xed, 0x24, 0xa6, 0xc0, 0xe1, 0xba, 0xe0, 0xb0, 0x88, 0xaf, 0x1e, 0x93, 0x7e, 0xbb, 0x0b, 0xa3, 0x5a, 0xb6, 0x90, 0xdc, 0x67, 0xf0, 0xef, 0x61, 0x13, 0x65, 0xd6, 0xa0, 0xe2, 0x26, 0xca, 0xdb, 0xad, 0xf4, 0xd5, 0x13, 0x58, 0x02, 0x8b, 0x6b, 0x82, 0xc5, 0x02, 0x36, 0x8f, 0x67, 0xa1, 0x3c, 0x90, 0x40, 0xe2, 0x67, 0x0d, 0x8d, 0x27, 0x57, 0x2e, 0x5c, 0x74, 0x0b, 0xfb, 0xee, 0x6f, 0xfa, 0xf2, 0x80, 0x56, 0xe5, 0x2f, 0x6f, 0xaf, 0xed, 0xb9, 0x30, 0x5d, 0xbf, 0xf9, 0xfc, 0xb0, 0xa2, 0xbd, 0x38, 0xac, 0x68, 0xaf, 0x0f, 0x2b, 0xda, 0x0f, 0x47, 0x95, 0xa1, 0x17, 0x47, 0x95, 0xa1, 0x97, 0x47, 0x95, 0xa1, 0xfb, 0x73, 0xca, 0x2f, 0xeb, 0xac, 0xbb, 0x6e, 0xe4, 0x50, 0xfc, 0xc4, 0xde, 0x19, 0x16, 0xff, 0x40, 0x5a, 0xfa, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xc4, 0x1b, 0x66, 0x45, 0x1a, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 // QueryClient is the client API for Query service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Queries a list of StakePoolInfo items. StakePoolInfo(ctx context.Context, in *QueryStakePoolInfoRequest, opts ...grpc.CallOption) (*QueryStakePoolInfoResponse, error) // Queries a list of StakeItemList items. StakeItemList(ctx context.Context, in *QueryStakeItemListRequest, opts ...grpc.CallOption) (*QueryStakeItemListResponse, error) // Queries a list of StakeReward items. StakeReward(ctx context.Context, in *QueryStakeRewardRequest, opts ...grpc.CallOption) (*QueryStakeRewardResponse, error) // Queries a list of StakeRecordCount items. StakeRecordCount(ctx context.Context, in *QueryStakeRecordCountRequest, opts ...grpc.CallOption) (*QueryStakeRecordCountResponse, error) // Queries a list of StakeRecord items. StakeRecord(ctx context.Context, in *QueryStakeRecordRequest, opts ...grpc.CallOption) (*QueryStakeRecordResponse, error) // Queries a list of StakeRecordList items. StakeRecordList(ctx context.Context, in *QueryStakeRecordListRequest, opts ...grpc.CallOption) (*QueryStakeRecordListResponse, error) // Queries a list of StakePoolList items. StakePoolList(ctx context.Context, in *QueryStakePoolListRequest, opts ...grpc.CallOption) (*QueryStakePoolListResponse, error) // Queries a list of MiningProviderList items. MiningProviderList(ctx context.Context, in *QueryMiningProviderListRequest, opts ...grpc.CallOption) (*QueryMiningProviderListResponse, error) // Queries a list of RewardTokenList items. RewardTokenList(ctx context.Context, in *QueryRewardTokenListRequest, opts ...grpc.CallOption) (*QueryRewardTokenListResponse, error) // Queries a list of MaxRewardPoolNumber items. MaxRewardPoolNumber(ctx context.Context, in *QueryMaxRewardPoolNumberRequest, opts ...grpc.CallOption) (*QueryMaxRewardPoolNumberResponse, error) // Queries a list of MaxStakeItemNumber items. MaxStakeItemNumber(ctx context.Context, in *QueryMaxStakeItemNumberRequest, opts ...grpc.CallOption) (*QueryMaxStakeItemNumberResponse, error) // Queries a list of ProviderSwitch items. ProviderSwitch(ctx context.Context, in *QueryProviderSwitchRequest, opts ...grpc.CallOption) (*QueryProviderSwitchResponse, error) } type queryClient struct { cc grpc1.ClientConn } func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/Params", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) StakePoolInfo(ctx context.Context, in *QueryStakePoolInfoRequest, opts ...grpc.CallOption) (*QueryStakePoolInfoResponse, error) { out := new(QueryStakePoolInfoResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/StakePoolInfo", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) StakeItemList(ctx context.Context, in *QueryStakeItemListRequest, opts ...grpc.CallOption) (*QueryStakeItemListResponse, error) { out := new(QueryStakeItemListResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/StakeItemList", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) StakeReward(ctx context.Context, in *QueryStakeRewardRequest, opts ...grpc.CallOption) (*QueryStakeRewardResponse, error) { out := new(QueryStakeRewardResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/StakeReward", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) StakeRecordCount(ctx context.Context, in *QueryStakeRecordCountRequest, opts ...grpc.CallOption) (*QueryStakeRecordCountResponse, error) { out := new(QueryStakeRecordCountResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/StakeRecordCount", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) StakeRecord(ctx context.Context, in *QueryStakeRecordRequest, opts ...grpc.CallOption) (*QueryStakeRecordResponse, error) { out := new(QueryStakeRecordResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/StakeRecord", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) StakeRecordList(ctx context.Context, in *QueryStakeRecordListRequest, opts ...grpc.CallOption) (*QueryStakeRecordListResponse, error) { out := new(QueryStakeRecordListResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/StakeRecordList", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) StakePoolList(ctx context.Context, in *QueryStakePoolListRequest, opts ...grpc.CallOption) (*QueryStakePoolListResponse, error) { out := new(QueryStakePoolListResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/StakePoolList", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) MiningProviderList(ctx context.Context, in *QueryMiningProviderListRequest, opts ...grpc.CallOption) (*QueryMiningProviderListResponse, error) { out := new(QueryMiningProviderListResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/MiningProviderList", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) RewardTokenList(ctx context.Context, in *QueryRewardTokenListRequest, opts ...grpc.CallOption) (*QueryRewardTokenListResponse, error) { out := new(QueryRewardTokenListResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/RewardTokenList", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) MaxRewardPoolNumber(ctx context.Context, in *QueryMaxRewardPoolNumberRequest, opts ...grpc.CallOption) (*QueryMaxRewardPoolNumberResponse, error) { out := new(QueryMaxRewardPoolNumberResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/MaxRewardPoolNumber", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) MaxStakeItemNumber(ctx context.Context, in *QueryMaxStakeItemNumberRequest, opts ...grpc.CallOption) (*QueryMaxStakeItemNumberResponse, error) { out := new(QueryMaxStakeItemNumberResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/MaxStakeItemNumber", in, out, opts...) if err != nil { return nil, err } return out, nil } func (c *queryClient) ProviderSwitch(ctx context.Context, in *QueryProviderSwitchRequest, opts ...grpc.CallOption) (*QueryProviderSwitchResponse, error) { out := new(QueryProviderSwitchResponse) err := c.cc.Invoke(ctx, "/stafihub.stafihub.mining.Query/ProviderSwitch", in, out, opts...) if err != nil { return nil, err } return out, nil } // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Queries a list of StakePoolInfo items. StakePoolInfo(context.Context, *QueryStakePoolInfoRequest) (*QueryStakePoolInfoResponse, error) // Queries a list of StakeItemList items. StakeItemList(context.Context, *QueryStakeItemListRequest) (*QueryStakeItemListResponse, error) // Queries a list of StakeReward items. StakeReward(context.Context, *QueryStakeRewardRequest) (*QueryStakeRewardResponse, error) // Queries a list of StakeRecordCount items. StakeRecordCount(context.Context, *QueryStakeRecordCountRequest) (*QueryStakeRecordCountResponse, error) // Queries a list of StakeRecord items. StakeRecord(context.Context, *QueryStakeRecordRequest) (*QueryStakeRecordResponse, error) // Queries a list of StakeRecordList items. StakeRecordList(context.Context, *QueryStakeRecordListRequest) (*QueryStakeRecordListResponse, error) // Queries a list of StakePoolList items. StakePoolList(context.Context, *QueryStakePoolListRequest) (*QueryStakePoolListResponse, error) // Queries a list of MiningProviderList items. MiningProviderList(context.Context, *QueryMiningProviderListRequest) (*QueryMiningProviderListResponse, error) // Queries a list of RewardTokenList items. RewardTokenList(context.Context, *QueryRewardTokenListRequest) (*QueryRewardTokenListResponse, error) // Queries a list of MaxRewardPoolNumber items. MaxRewardPoolNumber(context.Context, *QueryMaxRewardPoolNumberRequest) (*QueryMaxRewardPoolNumberResponse, error) // Queries a list of MaxStakeItemNumber items. MaxStakeItemNumber(context.Context, *QueryMaxStakeItemNumberRequest) (*QueryMaxStakeItemNumberResponse, error) // Queries a list of ProviderSwitch items. ProviderSwitch(context.Context, *QueryProviderSwitchRequest) (*QueryProviderSwitchResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } func (*UnimplementedQueryServer) StakePoolInfo(ctx context.Context, req *QueryStakePoolInfoRequest) (*QueryStakePoolInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StakePoolInfo not implemented") } func (*UnimplementedQueryServer) StakeItemList(ctx context.Context, req *QueryStakeItemListRequest) (*QueryStakeItemListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StakeItemList not implemented") } func (*UnimplementedQueryServer) StakeReward(ctx context.Context, req *QueryStakeRewardRequest) (*QueryStakeRewardResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StakeReward not implemented") } func (*UnimplementedQueryServer) StakeRecordCount(ctx context.Context, req *QueryStakeRecordCountRequest) (*QueryStakeRecordCountResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StakeRecordCount not implemented") } func (*UnimplementedQueryServer) StakeRecord(ctx context.Context, req *QueryStakeRecordRequest) (*QueryStakeRecordResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StakeRecord not implemented") } func (*UnimplementedQueryServer) StakeRecordList(ctx context.Context, req *QueryStakeRecordListRequest) (*QueryStakeRecordListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StakeRecordList not implemented") } func (*UnimplementedQueryServer) StakePoolList(ctx context.Context, req *QueryStakePoolListRequest) (*QueryStakePoolListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StakePoolList not implemented") } func (*UnimplementedQueryServer) MiningProviderList(ctx context.Context, req *QueryMiningProviderListRequest) (*QueryMiningProviderListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MiningProviderList not implemented") } func (*UnimplementedQueryServer) RewardTokenList(ctx context.Context, req *QueryRewardTokenListRequest) (*QueryRewardTokenListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RewardTokenList not implemented") } func (*UnimplementedQueryServer) MaxRewardPoolNumber(ctx context.Context, req *QueryMaxRewardPoolNumberRequest) (*QueryMaxRewardPoolNumberResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MaxRewardPoolNumber not implemented") } func (*UnimplementedQueryServer) MaxStakeItemNumber(ctx context.Context, req *QueryMaxStakeItemNumberRequest) (*QueryMaxStakeItemNumberResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MaxStakeItemNumber not implemented") } func (*UnimplementedQueryServer) ProviderSwitch(ctx context.Context, req *QueryProviderSwitchRequest) (*QueryProviderSwitchResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProviderSwitch not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryParamsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).Params(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) } return interceptor(ctx, in, info, handler) } func _Query_StakePoolInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStakePoolInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).StakePoolInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/StakePoolInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).StakePoolInfo(ctx, req.(*QueryStakePoolInfoRequest)) } return interceptor(ctx, in, info, handler) } func _Query_StakeItemList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStakeItemListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).StakeItemList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/StakeItemList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).StakeItemList(ctx, req.(*QueryStakeItemListRequest)) } return interceptor(ctx, in, info, handler) } func _Query_StakeReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStakeRewardRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).StakeReward(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/StakeReward", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).StakeReward(ctx, req.(*QueryStakeRewardRequest)) } return interceptor(ctx, in, info, handler) } func _Query_StakeRecordCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStakeRecordCountRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).StakeRecordCount(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/StakeRecordCount", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).StakeRecordCount(ctx, req.(*QueryStakeRecordCountRequest)) } return interceptor(ctx, in, info, handler) } func _Query_StakeRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStakeRecordRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).StakeRecord(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/StakeRecord", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).StakeRecord(ctx, req.(*QueryStakeRecordRequest)) } return interceptor(ctx, in, info, handler) } func _Query_StakeRecordList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStakeRecordListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).StakeRecordList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/StakeRecordList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).StakeRecordList(ctx, req.(*QueryStakeRecordListRequest)) } return interceptor(ctx, in, info, handler) } func _Query_StakePoolList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryStakePoolListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).StakePoolList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/StakePoolList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).StakePoolList(ctx, req.(*QueryStakePoolListRequest)) } return interceptor(ctx, in, info, handler) } func _Query_MiningProviderList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryMiningProviderListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).MiningProviderList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/MiningProviderList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).MiningProviderList(ctx, req.(*QueryMiningProviderListRequest)) } return interceptor(ctx, in, info, handler) } func _Query_RewardTokenList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryRewardTokenListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).RewardTokenList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/RewardTokenList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).RewardTokenList(ctx, req.(*QueryRewardTokenListRequest)) } return interceptor(ctx, in, info, handler) } func _Query_MaxRewardPoolNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryMaxRewardPoolNumberRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).MaxRewardPoolNumber(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/MaxRewardPoolNumber", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).MaxRewardPoolNumber(ctx, req.(*QueryMaxRewardPoolNumberRequest)) } return interceptor(ctx, in, info, handler) } func _Query_MaxStakeItemNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryMaxStakeItemNumberRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).MaxStakeItemNumber(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/MaxStakeItemNumber", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).MaxStakeItemNumber(ctx, req.(*QueryMaxStakeItemNumberRequest)) } return interceptor(ctx, in, info, handler) } func _Query_ProviderSwitch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryProviderSwitchRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(QueryServer).ProviderSwitch(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: "/stafihub.stafihub.mining.Query/ProviderSwitch", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).ProviderSwitch(ctx, req.(*QueryProviderSwitchRequest)) } return interceptor(ctx, in, info, handler) } var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "stafihub.stafihub.mining.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Params", Handler: _Query_Params_Handler, }, { MethodName: "StakePoolInfo", Handler: _Query_StakePoolInfo_Handler, }, { MethodName: "StakeItemList", Handler: _Query_StakeItemList_Handler, }, { MethodName: "StakeReward", Handler: _Query_StakeReward_Handler, }, { MethodName: "StakeRecordCount", Handler: _Query_StakeRecordCount_Handler, }, { MethodName: "StakeRecord", Handler: _Query_StakeRecord_Handler, }, { MethodName: "StakeRecordList", Handler: _Query_StakeRecordList_Handler, }, { MethodName: "StakePoolList", Handler: _Query_StakePoolList_Handler, }, { MethodName: "MiningProviderList", Handler: _Query_MiningProviderList_Handler, }, { MethodName: "RewardTokenList", Handler: _Query_RewardTokenList_Handler, }, { MethodName: "MaxRewardPoolNumber", Handler: _Query_MaxRewardPoolNumber_Handler, }, { MethodName: "MaxStakeItemNumber", Handler: _Query_MaxStakeItemNumber_Handler, }, { MethodName: "ProviderSwitch", Handler: _Query_ProviderSwitch_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "mining/query.proto", } func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *QueryStakePoolInfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakePoolInfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakePoolInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakePoolIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakePoolIndex)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *QueryStakePoolInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakePoolInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakePoolInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakePool != nil { { size, err := m.StakePool.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *QueryStakeItemListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeItemListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeItemListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakePoolIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakePoolIndex)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *QueryStakeItemListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeItemListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeItemListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.StakeItemList) > 0 { for iNdEx := len(m.StakeItemList) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.StakeItemList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *QueryStakeRewardRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRewardRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRewardRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakeRecordIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakeRecordIndex)) i-- dAtA[i] = 0x18 } if m.StakePoolIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakePoolIndex)) i-- dAtA[i] = 0x10 } if len(m.StakeUserAddress) > 0 { i -= len(m.StakeUserAddress) copy(dAtA[i:], m.StakeUserAddress) i = encodeVarintQuery(dAtA, i, uint64(len(m.StakeUserAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *QueryStakeRewardResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRewardResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.RewardTokens) > 0 { for iNdEx := len(m.RewardTokens) - 1; iNdEx >= 0; iNdEx-- { { size := m.RewardTokens[iNdEx].Size() i -= size if _, err := m.RewardTokens[iNdEx].MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *QueryStakeRecordCountRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRecordCountRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRecordCountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakePoolIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakePoolIndex)) i-- dAtA[i] = 0x10 } if len(m.UserAddress) > 0 { i -= len(m.UserAddress) copy(dAtA[i:], m.UserAddress) i = encodeVarintQuery(dAtA, i, uint64(len(m.UserAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *QueryStakeRecordCountResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRecordCountResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRecordCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Count != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Count)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *QueryStakeRecordRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRecordRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRecordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakeRecordIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakeRecordIndex)) i-- dAtA[i] = 0x18 } if m.StakePoolIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakePoolIndex)) i-- dAtA[i] = 0x10 } if len(m.UserAddress) > 0 { i -= len(m.UserAddress) copy(dAtA[i:], m.UserAddress) i = encodeVarintQuery(dAtA, i, uint64(len(m.UserAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *QueryStakeRecordResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRecordResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakeRecord != nil { { size, err := m.StakeRecord.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *QueryStakeRecordListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRecordListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRecordListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.StakePoolIndex != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.StakePoolIndex)) i-- dAtA[i] = 0x10 } if len(m.UserAddress) > 0 { i -= len(m.UserAddress) copy(dAtA[i:], m.UserAddress) i = encodeVarintQuery(dAtA, i, uint64(len(m.UserAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *QueryStakeRecordListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakeRecordListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakeRecordListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.StakeRecordList) > 0 { for iNdEx := len(m.StakeRecordList) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.StakeRecordList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *QueryStakePoolListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakePoolListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakePoolListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *QueryStakePoolListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryStakePoolListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryStakePoolListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.StakePoolList) > 0 { for iNdEx := len(m.StakePoolList) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.StakePoolList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *QueryMiningProviderListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryMiningProviderListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryMiningProviderListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *QueryMiningProviderListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryMiningProviderListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryMiningProviderListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.MiningProviderList) > 0 { for iNdEx := len(m.MiningProviderList) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.MiningProviderList[iNdEx]) copy(dAtA[i:], m.MiningProviderList[iNdEx]) i = encodeVarintQuery(dAtA, i, uint64(len(m.MiningProviderList[iNdEx]))) i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *QueryRewardTokenListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryRewardTokenListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryRewardTokenListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *QueryRewardTokenListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryRewardTokenListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryRewardTokenListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.RewardTokenList) > 0 { for iNdEx := len(m.RewardTokenList) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.RewardTokenList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *QueryMaxRewardPoolNumberRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryMaxRewardPoolNumberRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryMaxRewardPoolNumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *QueryMaxRewardPoolNumberResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryMaxRewardPoolNumberResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryMaxRewardPoolNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Number != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Number)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *QueryMaxStakeItemNumberRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryMaxStakeItemNumberRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryMaxStakeItemNumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *QueryMaxStakeItemNumberResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryMaxStakeItemNumberResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryMaxStakeItemNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Number != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Number)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *QueryProviderSwitchRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryProviderSwitchRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryProviderSwitchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l return len(dAtA) - i, nil } func (m *QueryProviderSwitchResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *QueryProviderSwitchResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *QueryProviderSwitchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.ProviderSwitch { i-- if m.ProviderSwitch { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *QueryParamsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.Params.Size() n += 1 + l + sovQuery(uint64(l)) return n } func (m *QueryStakePoolInfoRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.StakePoolIndex != 0 { n += 1 + sovQuery(uint64(m.StakePoolIndex)) } return n } func (m *QueryStakePoolInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.StakePool != nil { l = m.StakePool.Size() n += 1 + l + sovQuery(uint64(l)) } return n } func (m *QueryStakeItemListRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.StakePoolIndex != 0 { n += 1 + sovQuery(uint64(m.StakePoolIndex)) } return n } func (m *QueryStakeItemListResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.StakeItemList) > 0 { for _, e := range m.StakeItemList { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } } return n } func (m *QueryStakeRewardRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.StakeUserAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } if m.StakePoolIndex != 0 { n += 1 + sovQuery(uint64(m.StakePoolIndex)) } if m.StakeRecordIndex != 0 { n += 1 + sovQuery(uint64(m.StakeRecordIndex)) } return n } func (m *QueryStakeRewardResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.RewardTokens) > 0 { for _, e := range m.RewardTokens { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } } return n } func (m *QueryStakeRecordCountRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.UserAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } if m.StakePoolIndex != 0 { n += 1 + sovQuery(uint64(m.StakePoolIndex)) } return n } func (m *QueryStakeRecordCountResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Count != 0 { n += 1 + sovQuery(uint64(m.Count)) } return n } func (m *QueryStakeRecordRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.UserAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } if m.StakePoolIndex != 0 { n += 1 + sovQuery(uint64(m.StakePoolIndex)) } if m.StakeRecordIndex != 0 { n += 1 + sovQuery(uint64(m.StakeRecordIndex)) } return n } func (m *QueryStakeRecordResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.StakeRecord != nil { l = m.StakeRecord.Size() n += 1 + l + sovQuery(uint64(l)) } return n } func (m *QueryStakeRecordListRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.UserAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } if m.StakePoolIndex != 0 { n += 1 + sovQuery(uint64(m.StakePoolIndex)) } return n } func (m *QueryStakeRecordListResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.StakeRecordList) > 0 { for _, e := range m.StakeRecordList { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } } return n } func (m *QueryStakePoolListRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *QueryStakePoolListResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.StakePoolList) > 0 { for _, e := range m.StakePoolList { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } } return n } func (m *QueryMiningProviderListRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *QueryMiningProviderListResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.MiningProviderList) > 0 { for _, s := range m.MiningProviderList { l = len(s) n += 1 + l + sovQuery(uint64(l)) } } return n } func (m *QueryRewardTokenListRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *QueryRewardTokenListResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.RewardTokenList) > 0 { for _, e := range m.RewardTokenList { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } } return n } func (m *QueryMaxRewardPoolNumberRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *QueryMaxRewardPoolNumberResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Number != 0 { n += 1 + sovQuery(uint64(m.Number)) } return n } func (m *QueryMaxStakeItemNumberRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *QueryMaxStakeItemNumberResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Number != 0 { n += 1 + sovQuery(uint64(m.Number)) } return n } func (m *QueryProviderSwitchRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l return n } func (m *QueryProviderSwitchResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.ProviderSwitch { n += 2 } return n } func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakePoolInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakePoolInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakePoolInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakePoolIndex", wireType) } m.StakePoolIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakePoolIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakePoolInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakePoolInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakePoolInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakePool", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } if m.StakePool == nil { m.StakePool = &StakePool{} } if err := m.StakePool.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeItemListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeItemListRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeItemListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakePoolIndex", wireType) } m.StakePoolIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakePoolIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeItemListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeItemListResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeItemListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakeItemList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.StakeItemList = append(m.StakeItemList, &StakeItem{}) if err := m.StakeItemList[len(m.StakeItemList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRewardRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRewardRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRewardRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakeUserAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.StakeUserAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakePoolIndex", wireType) } m.StakePoolIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakePoolIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakeRecordIndex", wireType) } m.StakeRecordIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakeRecordIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRewardResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRewardResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardTokens", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.RewardTokens = append(m.RewardTokens, github_com_cosmos_cosmos_sdk_types.Coin{}) if err := m.RewardTokens[len(m.RewardTokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRecordCountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRecordCountRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRecordCountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UserAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.UserAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakePoolIndex", wireType) } m.StakePoolIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakePoolIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRecordCountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRecordCountResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRecordCountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) } m.Count = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Count |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRecordRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRecordRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRecordRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UserAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.UserAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakePoolIndex", wireType) } m.StakePoolIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakePoolIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakeRecordIndex", wireType) } m.StakeRecordIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakeRecordIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRecordResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRecordResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakeRecord", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } if m.StakeRecord == nil { m.StakeRecord = &UserStakeRecord{} } if err := m.StakeRecord.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRecordListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRecordListRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRecordListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UserAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.UserAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StakePoolIndex", wireType) } m.StakePoolIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.StakePoolIndex |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakeRecordListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakeRecordListResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakeRecordListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakeRecordList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.StakeRecordList = append(m.StakeRecordList, &UserStakeRecord{}) if err := m.StakeRecordList[len(m.StakeRecordList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakePoolListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakePoolListRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakePoolListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryStakePoolListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryStakePoolListResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryStakePoolListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakePoolList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.StakePoolList = append(m.StakePoolList, &StakePool{}) if err := m.StakePoolList[len(m.StakePoolList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryMiningProviderListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryMiningProviderListRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryMiningProviderListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryMiningProviderListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryMiningProviderListResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryMiningProviderListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MiningProviderList", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.MiningProviderList = append(m.MiningProviderList, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryRewardTokenListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryRewardTokenListRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryRewardTokenListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryRewardTokenListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryRewardTokenListResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryRewardTokenListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardTokenList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthQuery } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } m.RewardTokenList = append(m.RewardTokenList, &RewardToken{}) if err := m.RewardTokenList[len(m.RewardTokenList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryMaxRewardPoolNumberRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryMaxRewardPoolNumberRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryMaxRewardPoolNumberRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryMaxRewardPoolNumberResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryMaxRewardPoolNumberResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryMaxRewardPoolNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) } m.Number = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Number |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryMaxStakeItemNumberRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryMaxStakeItemNumberRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryMaxStakeItemNumberRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryMaxStakeItemNumberResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryMaxStakeItemNumberResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryMaxStakeItemNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) } m.Number = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Number |= uint32(b&0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryProviderSwitchRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryProviderSwitchRequest: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryProviderSwitchRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *QueryProviderSwitchResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: QueryProviderSwitchResponse: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: QueryProviderSwitchResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ProviderSwitch", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.ProviderSwitch = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowQuery } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowQuery } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowQuery } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthQuery } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupQuery } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthQuery } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") )
28.077536
176
0.684975
41ba17cb29657392961525c9fd4d85163a750e1e
47,481
c
C
drivers/net/ethernet/marvell/prestera/prestera_hw.c
jainsakshi2395/linux
7ccb860232bb83fb60cd6bcf5aaf0c008d903acb
[ "Linux-OpenIB" ]
null
null
null
drivers/net/ethernet/marvell/prestera/prestera_hw.c
jainsakshi2395/linux
7ccb860232bb83fb60cd6bcf5aaf0c008d903acb
[ "Linux-OpenIB" ]
null
null
null
drivers/net/ethernet/marvell/prestera/prestera_hw.c
jainsakshi2395/linux
7ccb860232bb83fb60cd6bcf5aaf0c008d903acb
[ "Linux-OpenIB" ]
null
null
null
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /* Copyright (c) 2019-2020 Marvell International Ltd. All rights reserved */ #include <linux/etherdevice.h> #include <linux/if_bridge.h> #include <linux/ethtool.h> #include <linux/list.h> #include "prestera.h" #include "prestera_hw.h" #include "prestera_acl.h" #define PRESTERA_SWITCH_INIT_TIMEOUT_MS (30 * 1000) #define PRESTERA_MIN_MTU 64 enum prestera_cmd_type_t { PRESTERA_CMD_TYPE_SWITCH_INIT = 0x1, PRESTERA_CMD_TYPE_SWITCH_ATTR_SET = 0x2, PRESTERA_CMD_TYPE_PORT_ATTR_SET = 0x100, PRESTERA_CMD_TYPE_PORT_ATTR_GET = 0x101, PRESTERA_CMD_TYPE_PORT_INFO_GET = 0x110, PRESTERA_CMD_TYPE_VLAN_CREATE = 0x200, PRESTERA_CMD_TYPE_VLAN_DELETE = 0x201, PRESTERA_CMD_TYPE_VLAN_PORT_SET = 0x202, PRESTERA_CMD_TYPE_VLAN_PVID_SET = 0x203, PRESTERA_CMD_TYPE_FDB_ADD = 0x300, PRESTERA_CMD_TYPE_FDB_DELETE = 0x301, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT = 0x310, PRESTERA_CMD_TYPE_FDB_FLUSH_VLAN = 0x311, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT_VLAN = 0x312, PRESTERA_CMD_TYPE_BRIDGE_CREATE = 0x400, PRESTERA_CMD_TYPE_BRIDGE_DELETE = 0x401, PRESTERA_CMD_TYPE_BRIDGE_PORT_ADD = 0x402, PRESTERA_CMD_TYPE_BRIDGE_PORT_DELETE = 0x403, PRESTERA_CMD_TYPE_ACL_RULE_ADD = 0x500, PRESTERA_CMD_TYPE_ACL_RULE_DELETE = 0x501, PRESTERA_CMD_TYPE_ACL_RULE_STATS_GET = 0x510, PRESTERA_CMD_TYPE_ACL_RULESET_CREATE = 0x520, PRESTERA_CMD_TYPE_ACL_RULESET_DELETE = 0x521, PRESTERA_CMD_TYPE_ACL_PORT_BIND = 0x530, PRESTERA_CMD_TYPE_ACL_PORT_UNBIND = 0x531, PRESTERA_CMD_TYPE_RXTX_INIT = 0x800, PRESTERA_CMD_TYPE_LAG_MEMBER_ADD = 0x900, PRESTERA_CMD_TYPE_LAG_MEMBER_DELETE = 0x901, PRESTERA_CMD_TYPE_LAG_MEMBER_ENABLE = 0x902, PRESTERA_CMD_TYPE_LAG_MEMBER_DISABLE = 0x903, PRESTERA_CMD_TYPE_STP_PORT_SET = 0x1000, PRESTERA_CMD_TYPE_SPAN_GET = 0x1100, PRESTERA_CMD_TYPE_SPAN_BIND = 0x1101, PRESTERA_CMD_TYPE_SPAN_UNBIND = 0x1102, PRESTERA_CMD_TYPE_SPAN_RELEASE = 0x1103, PRESTERA_CMD_TYPE_CPU_CODE_COUNTERS_GET = 0x2000, PRESTERA_CMD_TYPE_ACK = 0x10000, PRESTERA_CMD_TYPE_MAX }; enum { PRESTERA_CMD_PORT_ATTR_ADMIN_STATE = 1, PRESTERA_CMD_PORT_ATTR_MTU = 3, PRESTERA_CMD_PORT_ATTR_MAC = 4, PRESTERA_CMD_PORT_ATTR_SPEED = 5, PRESTERA_CMD_PORT_ATTR_ACCEPT_FRAME_TYPE = 6, PRESTERA_CMD_PORT_ATTR_LEARNING = 7, PRESTERA_CMD_PORT_ATTR_FLOOD = 8, PRESTERA_CMD_PORT_ATTR_CAPABILITY = 9, PRESTERA_CMD_PORT_ATTR_PHY_MODE = 12, PRESTERA_CMD_PORT_ATTR_TYPE = 13, PRESTERA_CMD_PORT_ATTR_STATS = 17, PRESTERA_CMD_PORT_ATTR_MAC_AUTONEG_RESTART = 18, PRESTERA_CMD_PORT_ATTR_PHY_AUTONEG_RESTART = 19, PRESTERA_CMD_PORT_ATTR_MAC_MODE = 22, }; enum { PRESTERA_CMD_SWITCH_ATTR_MAC = 1, PRESTERA_CMD_SWITCH_ATTR_AGEING = 2, }; enum { PRESTERA_CMD_ACK_OK, PRESTERA_CMD_ACK_FAILED, PRESTERA_CMD_ACK_MAX }; enum { PRESTERA_PORT_TP_NA, PRESTERA_PORT_TP_MDI, PRESTERA_PORT_TP_MDIX, PRESTERA_PORT_TP_AUTO, }; enum { PRESTERA_PORT_FLOOD_TYPE_UC = 0, PRESTERA_PORT_FLOOD_TYPE_MC = 1, }; enum { PRESTERA_PORT_GOOD_OCTETS_RCV_CNT, PRESTERA_PORT_BAD_OCTETS_RCV_CNT, PRESTERA_PORT_MAC_TRANSMIT_ERR_CNT, PRESTERA_PORT_BRDC_PKTS_RCV_CNT, PRESTERA_PORT_MC_PKTS_RCV_CNT, PRESTERA_PORT_PKTS_64L_CNT, PRESTERA_PORT_PKTS_65TO127L_CNT, PRESTERA_PORT_PKTS_128TO255L_CNT, PRESTERA_PORT_PKTS_256TO511L_CNT, PRESTERA_PORT_PKTS_512TO1023L_CNT, PRESTERA_PORT_PKTS_1024TOMAXL_CNT, PRESTERA_PORT_EXCESSIVE_COLLISIONS_CNT, PRESTERA_PORT_MC_PKTS_SENT_CNT, PRESTERA_PORT_BRDC_PKTS_SENT_CNT, PRESTERA_PORT_FC_SENT_CNT, PRESTERA_PORT_GOOD_FC_RCV_CNT, PRESTERA_PORT_DROP_EVENTS_CNT, PRESTERA_PORT_UNDERSIZE_PKTS_CNT, PRESTERA_PORT_FRAGMENTS_PKTS_CNT, PRESTERA_PORT_OVERSIZE_PKTS_CNT, PRESTERA_PORT_JABBER_PKTS_CNT, PRESTERA_PORT_MAC_RCV_ERROR_CNT, PRESTERA_PORT_BAD_CRC_CNT, PRESTERA_PORT_COLLISIONS_CNT, PRESTERA_PORT_LATE_COLLISIONS_CNT, PRESTERA_PORT_GOOD_UC_PKTS_RCV_CNT, PRESTERA_PORT_GOOD_UC_PKTS_SENT_CNT, PRESTERA_PORT_MULTIPLE_PKTS_SENT_CNT, PRESTERA_PORT_DEFERRED_PKTS_SENT_CNT, PRESTERA_PORT_GOOD_OCTETS_SENT_CNT, PRESTERA_PORT_CNT_MAX }; enum { PRESTERA_FC_NONE, PRESTERA_FC_SYMMETRIC, PRESTERA_FC_ASYMMETRIC, PRESTERA_FC_SYMM_ASYMM, }; enum { PRESTERA_HW_FDB_ENTRY_TYPE_REG_PORT = 0, PRESTERA_HW_FDB_ENTRY_TYPE_LAG = 1, PRESTERA_HW_FDB_ENTRY_TYPE_MAX = 2, }; struct prestera_fw_event_handler { struct list_head list; struct rcu_head rcu; enum prestera_event_type type; prestera_event_cb_t func; void *arg; }; struct prestera_msg_cmd { __le32 type; }; struct prestera_msg_ret { struct prestera_msg_cmd cmd; __le32 status; }; struct prestera_msg_common_req { struct prestera_msg_cmd cmd; }; struct prestera_msg_common_resp { struct prestera_msg_ret ret; }; union prestera_msg_switch_param { u8 mac[ETH_ALEN]; __le32 ageing_timeout_ms; } __packed; struct prestera_msg_switch_attr_req { struct prestera_msg_cmd cmd; __le32 attr; union prestera_msg_switch_param param; }; struct prestera_msg_switch_init_resp { struct prestera_msg_ret ret; __le32 port_count; __le32 mtu_max; u8 switch_id; u8 lag_max; u8 lag_member_max; __le32 size_tbl_router_nexthop; } __packed __aligned(4); struct prestera_msg_event_port_param { union { struct { u8 oper; __le32 mode; __le32 speed; u8 duplex; u8 fc; u8 fec; } __packed mac; struct { u8 mdix; __le64 lmode_bmap; u8 fc; } __packed phy; } __packed; } __packed __aligned(4); struct prestera_msg_port_cap_param { __le64 link_mode; u8 type; u8 fec; u8 fc; u8 transceiver; }; struct prestera_msg_port_flood_param { u8 type; u8 enable; }; union prestera_msg_port_param { u8 admin_state; u8 oper_state; __le32 mtu; u8 mac[ETH_ALEN]; u8 accept_frm_type; __le32 speed; u8 learning; u8 flood; __le32 link_mode; u8 type; u8 duplex; u8 fec; u8 fc; union { struct { u8 admin:1; u8 fc; u8 ap_enable; union { struct { __le32 mode; u8 inband:1; __le32 speed; u8 duplex; u8 fec; u8 fec_supp; } __packed reg_mode; struct { __le32 mode; __le32 speed; u8 fec; u8 fec_supp; } __packed ap_modes[PRESTERA_AP_PORT_MAX]; } __packed; } __packed mac; struct { u8 admin:1; u8 adv_enable; __le64 modes; __le32 mode; u8 mdix; } __packed phy; } __packed link; struct prestera_msg_port_cap_param cap; struct prestera_msg_port_flood_param flood_ext; struct prestera_msg_event_port_param link_evt; } __packed; struct prestera_msg_port_attr_req { struct prestera_msg_cmd cmd; __le32 attr; __le32 port; __le32 dev; union prestera_msg_port_param param; } __packed __aligned(4); struct prestera_msg_port_attr_resp { struct prestera_msg_ret ret; union prestera_msg_port_param param; } __packed __aligned(4); struct prestera_msg_port_stats_resp { struct prestera_msg_ret ret; __le64 stats[PRESTERA_PORT_CNT_MAX]; }; struct prestera_msg_port_info_req { struct prestera_msg_cmd cmd; __le32 port; }; struct prestera_msg_port_info_resp { struct prestera_msg_ret ret; __le32 hw_id; __le32 dev_id; __le16 fp_id; }; struct prestera_msg_vlan_req { struct prestera_msg_cmd cmd; __le32 port; __le32 dev; __le16 vid; u8 is_member; u8 is_tagged; }; struct prestera_msg_fdb_req { struct prestera_msg_cmd cmd; u8 dest_type; union { struct { __le32 port; __le32 dev; }; __le16 lag_id; } dest; u8 mac[ETH_ALEN]; __le16 vid; u8 dynamic; __le32 flush_mode; } __packed __aligned(4); struct prestera_msg_bridge_req { struct prestera_msg_cmd cmd; __le32 port; __le32 dev; __le16 bridge; }; struct prestera_msg_bridge_resp { struct prestera_msg_ret ret; __le16 bridge; }; struct prestera_msg_acl_action { __le32 id; __le32 reserved[5]; }; struct prestera_msg_acl_match { __le32 type; union { struct { u8 key; u8 mask; } __packed u8; struct { __le16 key; __le16 mask; } u16; struct { __le32 key; __le32 mask; } u32; struct { __le64 key; __le64 mask; } u64; struct { u8 key[ETH_ALEN]; u8 mask[ETH_ALEN]; } __packed mac; } keymask; }; struct prestera_msg_acl_rule_req { struct prestera_msg_cmd cmd; __le32 id; __le32 priority; __le16 ruleset_id; u8 n_actions; u8 n_matches; }; struct prestera_msg_acl_rule_resp { struct prestera_msg_ret ret; __le32 id; }; struct prestera_msg_acl_rule_stats_resp { struct prestera_msg_ret ret; __le64 packets; __le64 bytes; }; struct prestera_msg_acl_ruleset_bind_req { struct prestera_msg_cmd cmd; __le32 port; __le32 dev; __le16 ruleset_id; }; struct prestera_msg_acl_ruleset_req { struct prestera_msg_cmd cmd; __le16 id; }; struct prestera_msg_acl_ruleset_resp { struct prestera_msg_ret ret; __le16 id; }; struct prestera_msg_span_req { struct prestera_msg_cmd cmd; __le32 port; __le32 dev; u8 id; }; struct prestera_msg_span_resp { struct prestera_msg_ret ret; u8 id; }; struct prestera_msg_stp_req { struct prestera_msg_cmd cmd; __le32 port; __le32 dev; __le16 vid; u8 state; }; struct prestera_msg_rxtx_req { struct prestera_msg_cmd cmd; u8 use_sdma; }; struct prestera_msg_rxtx_resp { struct prestera_msg_ret ret; __le32 map_addr; }; struct prestera_msg_lag_req { struct prestera_msg_cmd cmd; __le32 port; __le32 dev; __le16 lag_id; }; struct prestera_msg_cpu_code_counter_req { struct prestera_msg_cmd cmd; u8 counter_type; u8 code; }; struct mvsw_msg_cpu_code_counter_ret { struct prestera_msg_ret ret; __le64 packet_count; }; struct prestera_msg_event { __le16 type; __le16 id; }; struct prestera_msg_event_port { struct prestera_msg_event id; __le32 port_id; struct prestera_msg_event_port_param param; }; union prestera_msg_event_fdb_param { u8 mac[ETH_ALEN]; }; struct prestera_msg_event_fdb { struct prestera_msg_event id; u8 dest_type; union { __le32 port_id; __le16 lag_id; } dest; __le32 vid; union prestera_msg_event_fdb_param param; } __packed __aligned(4); static inline void prestera_hw_build_tests(void) { /* check requests */ BUILD_BUG_ON(sizeof(struct prestera_msg_common_req) != 4); BUILD_BUG_ON(sizeof(struct prestera_msg_switch_attr_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_port_attr_req) != 120); BUILD_BUG_ON(sizeof(struct prestera_msg_port_info_req) != 8); BUILD_BUG_ON(sizeof(struct prestera_msg_vlan_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_fdb_req) != 28); BUILD_BUG_ON(sizeof(struct prestera_msg_bridge_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_acl_rule_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_acl_ruleset_bind_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_acl_ruleset_req) != 8); BUILD_BUG_ON(sizeof(struct prestera_msg_span_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_stp_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_rxtx_req) != 8); BUILD_BUG_ON(sizeof(struct prestera_msg_lag_req) != 16); BUILD_BUG_ON(sizeof(struct prestera_msg_cpu_code_counter_req) != 8); /* check responses */ BUILD_BUG_ON(sizeof(struct prestera_msg_common_resp) != 8); BUILD_BUG_ON(sizeof(struct prestera_msg_switch_init_resp) != 24); BUILD_BUG_ON(sizeof(struct prestera_msg_port_attr_resp) != 112); BUILD_BUG_ON(sizeof(struct prestera_msg_port_stats_resp) != 248); BUILD_BUG_ON(sizeof(struct prestera_msg_port_info_resp) != 20); BUILD_BUG_ON(sizeof(struct prestera_msg_bridge_resp) != 12); BUILD_BUG_ON(sizeof(struct prestera_msg_acl_rule_resp) != 12); BUILD_BUG_ON(sizeof(struct prestera_msg_acl_rule_stats_resp) != 24); BUILD_BUG_ON(sizeof(struct prestera_msg_acl_ruleset_resp) != 12); BUILD_BUG_ON(sizeof(struct prestera_msg_span_resp) != 12); BUILD_BUG_ON(sizeof(struct prestera_msg_rxtx_resp) != 12); /* check events */ BUILD_BUG_ON(sizeof(struct prestera_msg_event_port) != 20); BUILD_BUG_ON(sizeof(struct prestera_msg_event_fdb) != 20); } static u8 prestera_hw_mdix_to_eth(u8 mode); static void prestera_hw_remote_fc_to_eth(u8 fc, bool *pause, bool *asym_pause); static int __prestera_cmd_ret(struct prestera_switch *sw, enum prestera_cmd_type_t type, struct prestera_msg_cmd *cmd, size_t clen, struct prestera_msg_ret *ret, size_t rlen, int waitms) { struct prestera_device *dev = sw->dev; int err; cmd->type = __cpu_to_le32(type); err = dev->send_req(dev, 0, cmd, clen, ret, rlen, waitms); if (err) return err; if (__le32_to_cpu(ret->cmd.type) != PRESTERA_CMD_TYPE_ACK) return -EBADE; if (__le32_to_cpu(ret->status) != PRESTERA_CMD_ACK_OK) return -EINVAL; return 0; } static int prestera_cmd_ret(struct prestera_switch *sw, enum prestera_cmd_type_t type, struct prestera_msg_cmd *cmd, size_t clen, struct prestera_msg_ret *ret, size_t rlen) { return __prestera_cmd_ret(sw, type, cmd, clen, ret, rlen, 0); } static int prestera_cmd_ret_wait(struct prestera_switch *sw, enum prestera_cmd_type_t type, struct prestera_msg_cmd *cmd, size_t clen, struct prestera_msg_ret *ret, size_t rlen, int waitms) { return __prestera_cmd_ret(sw, type, cmd, clen, ret, rlen, waitms); } static int prestera_cmd(struct prestera_switch *sw, enum prestera_cmd_type_t type, struct prestera_msg_cmd *cmd, size_t clen) { struct prestera_msg_common_resp resp; return prestera_cmd_ret(sw, type, cmd, clen, &resp.ret, sizeof(resp)); } static int prestera_fw_parse_port_evt(void *msg, struct prestera_event *evt) { struct prestera_msg_event_port *hw_evt; hw_evt = (struct prestera_msg_event_port *)msg; evt->port_evt.port_id = __le32_to_cpu(hw_evt->port_id); if (evt->id == PRESTERA_PORT_EVENT_MAC_STATE_CHANGED) { evt->port_evt.data.mac.oper = hw_evt->param.mac.oper; evt->port_evt.data.mac.mode = __le32_to_cpu(hw_evt->param.mac.mode); evt->port_evt.data.mac.speed = __le32_to_cpu(hw_evt->param.mac.speed); evt->port_evt.data.mac.duplex = hw_evt->param.mac.duplex; evt->port_evt.data.mac.fc = hw_evt->param.mac.fc; evt->port_evt.data.mac.fec = hw_evt->param.mac.fec; } else { return -EINVAL; } return 0; } static int prestera_fw_parse_fdb_evt(void *msg, struct prestera_event *evt) { struct prestera_msg_event_fdb *hw_evt = msg; switch (hw_evt->dest_type) { case PRESTERA_HW_FDB_ENTRY_TYPE_REG_PORT: evt->fdb_evt.type = PRESTERA_FDB_ENTRY_TYPE_REG_PORT; evt->fdb_evt.dest.port_id = __le32_to_cpu(hw_evt->dest.port_id); break; case PRESTERA_HW_FDB_ENTRY_TYPE_LAG: evt->fdb_evt.type = PRESTERA_FDB_ENTRY_TYPE_LAG; evt->fdb_evt.dest.lag_id = __le16_to_cpu(hw_evt->dest.lag_id); break; default: return -EINVAL; } evt->fdb_evt.vid = __le32_to_cpu(hw_evt->vid); ether_addr_copy(evt->fdb_evt.data.mac, hw_evt->param.mac); return 0; } static struct prestera_fw_evt_parser { int (*func)(void *msg, struct prestera_event *evt); } fw_event_parsers[PRESTERA_EVENT_TYPE_MAX] = { [PRESTERA_EVENT_TYPE_PORT] = { .func = prestera_fw_parse_port_evt }, [PRESTERA_EVENT_TYPE_FDB] = { .func = prestera_fw_parse_fdb_evt }, }; static struct prestera_fw_event_handler * __find_event_handler(const struct prestera_switch *sw, enum prestera_event_type type) { struct prestera_fw_event_handler *eh; list_for_each_entry_rcu(eh, &sw->event_handlers, list) { if (eh->type == type) return eh; } return NULL; } static int prestera_find_event_handler(const struct prestera_switch *sw, enum prestera_event_type type, struct prestera_fw_event_handler *eh) { struct prestera_fw_event_handler *tmp; int err = 0; rcu_read_lock(); tmp = __find_event_handler(sw, type); if (tmp) *eh = *tmp; else err = -ENOENT; rcu_read_unlock(); return err; } static int prestera_evt_recv(struct prestera_device *dev, void *buf, size_t size) { struct prestera_switch *sw = dev->priv; struct prestera_msg_event *msg = buf; struct prestera_fw_event_handler eh; struct prestera_event evt; u16 msg_type; int err; msg_type = __le16_to_cpu(msg->type); if (msg_type >= PRESTERA_EVENT_TYPE_MAX) return -EINVAL; if (!fw_event_parsers[msg_type].func) return -ENOENT; err = prestera_find_event_handler(sw, msg_type, &eh); if (err) return err; evt.id = __le16_to_cpu(msg->id); err = fw_event_parsers[msg_type].func(buf, &evt); if (err) return err; eh.func(sw, &evt, eh.arg); return 0; } static void prestera_pkt_recv(struct prestera_device *dev) { struct prestera_switch *sw = dev->priv; struct prestera_fw_event_handler eh; struct prestera_event ev; int err; ev.id = PRESTERA_RXTX_EVENT_RCV_PKT; err = prestera_find_event_handler(sw, PRESTERA_EVENT_TYPE_RXTX, &eh); if (err) return; eh.func(sw, &ev, eh.arg); } static u8 prestera_hw_mdix_to_eth(u8 mode) { switch (mode) { case PRESTERA_PORT_TP_MDI: return ETH_TP_MDI; case PRESTERA_PORT_TP_MDIX: return ETH_TP_MDI_X; case PRESTERA_PORT_TP_AUTO: return ETH_TP_MDI_AUTO; default: return ETH_TP_MDI_INVALID; } } static u8 prestera_hw_mdix_from_eth(u8 mode) { switch (mode) { case ETH_TP_MDI: return PRESTERA_PORT_TP_MDI; case ETH_TP_MDI_X: return PRESTERA_PORT_TP_MDIX; case ETH_TP_MDI_AUTO: return PRESTERA_PORT_TP_AUTO; default: return PRESTERA_PORT_TP_NA; } } int prestera_hw_port_info_get(const struct prestera_port *port, u32 *dev_id, u32 *hw_id, u16 *fp_id) { struct prestera_msg_port_info_req req = { .port = __cpu_to_le32(port->id), }; struct prestera_msg_port_info_resp resp; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_INFO_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *dev_id = __le32_to_cpu(resp.dev_id); *hw_id = __le32_to_cpu(resp.hw_id); *fp_id = __le16_to_cpu(resp.fp_id); return 0; } int prestera_hw_switch_mac_set(struct prestera_switch *sw, const char *mac) { struct prestera_msg_switch_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_SWITCH_ATTR_MAC), }; ether_addr_copy(req.param.mac, mac); return prestera_cmd(sw, PRESTERA_CMD_TYPE_SWITCH_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_switch_init(struct prestera_switch *sw) { struct prestera_msg_switch_init_resp resp; struct prestera_msg_common_req req; int err; INIT_LIST_HEAD(&sw->event_handlers); prestera_hw_build_tests(); err = prestera_cmd_ret_wait(sw, PRESTERA_CMD_TYPE_SWITCH_INIT, &req.cmd, sizeof(req), &resp.ret, sizeof(resp), PRESTERA_SWITCH_INIT_TIMEOUT_MS); if (err) return err; sw->dev->recv_msg = prestera_evt_recv; sw->dev->recv_pkt = prestera_pkt_recv; sw->port_count = __le32_to_cpu(resp.port_count); sw->mtu_min = PRESTERA_MIN_MTU; sw->mtu_max = __le32_to_cpu(resp.mtu_max); sw->id = resp.switch_id; sw->lag_member_max = resp.lag_member_max; sw->lag_max = resp.lag_max; return 0; } void prestera_hw_switch_fini(struct prestera_switch *sw) { WARN_ON(!list_empty(&sw->event_handlers)); } int prestera_hw_switch_ageing_set(struct prestera_switch *sw, u32 ageing_ms) { struct prestera_msg_switch_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_SWITCH_ATTR_AGEING), .param = { .ageing_timeout_ms = __cpu_to_le32(ageing_ms), }, }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_SWITCH_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_mac_mode_get(const struct prestera_port *port, u32 *mode, u32 *speed, u8 *duplex, u8 *fec) { struct prestera_msg_port_attr_resp resp; struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_MAC_MODE), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id) }; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; if (mode) *mode = __le32_to_cpu(resp.param.link_evt.mac.mode); if (speed) *speed = __le32_to_cpu(resp.param.link_evt.mac.speed); if (duplex) *duplex = resp.param.link_evt.mac.duplex; if (fec) *fec = resp.param.link_evt.mac.fec; return err; } int prestera_hw_port_mac_mode_set(const struct prestera_port *port, bool admin, u32 mode, u8 inband, u32 speed, u8 duplex, u8 fec) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_MAC_MODE), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .link = { .mac = { .admin = admin, .reg_mode.mode = __cpu_to_le32(mode), .reg_mode.inband = inband, .reg_mode.speed = __cpu_to_le32(speed), .reg_mode.duplex = duplex, .reg_mode.fec = fec } } } }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_phy_mode_get(const struct prestera_port *port, u8 *mdix, u64 *lmode_bmap, bool *fc_pause, bool *fc_asym) { struct prestera_msg_port_attr_resp resp; struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_PHY_MODE), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id) }; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; if (mdix) *mdix = prestera_hw_mdix_to_eth(resp.param.link_evt.phy.mdix); if (lmode_bmap) *lmode_bmap = __le64_to_cpu(resp.param.link_evt.phy.lmode_bmap); if (fc_pause && fc_asym) prestera_hw_remote_fc_to_eth(resp.param.link_evt.phy.fc, fc_pause, fc_asym); return err; } int prestera_hw_port_phy_mode_set(const struct prestera_port *port, bool admin, bool adv, u32 mode, u64 modes, u8 mdix) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_PHY_MODE), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .link = { .phy = { .admin = admin, .adv_enable = adv ? 1 : 0, .mode = __cpu_to_le32(mode), .modes = __cpu_to_le64(modes), } } } }; req.param.link.phy.mdix = prestera_hw_mdix_from_eth(mdix); return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_mtu_set(const struct prestera_port *port, u32 mtu) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_MTU), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .mtu = __cpu_to_le32(mtu), } }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_mac_set(const struct prestera_port *port, const char *mac) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_MAC), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; ether_addr_copy(req.param.mac, mac); return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_accept_frm_type(struct prestera_port *port, enum prestera_accept_frm_type type) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_ACCEPT_FRAME_TYPE), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .accept_frm_type = type, } }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_cap_get(const struct prestera_port *port, struct prestera_port_caps *caps) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_CAPABILITY), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; struct prestera_msg_port_attr_resp resp; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; caps->supp_link_modes = __le64_to_cpu(resp.param.cap.link_mode); caps->transceiver = resp.param.cap.transceiver; caps->supp_fec = resp.param.cap.fec; caps->type = resp.param.cap.type; return err; } static void prestera_hw_remote_fc_to_eth(u8 fc, bool *pause, bool *asym_pause) { switch (fc) { case PRESTERA_FC_SYMMETRIC: *pause = true; *asym_pause = false; break; case PRESTERA_FC_ASYMMETRIC: *pause = false; *asym_pause = true; break; case PRESTERA_FC_SYMM_ASYMM: *pause = true; *asym_pause = true; break; default: *pause = false; *asym_pause = false; } } int prestera_hw_acl_ruleset_create(struct prestera_switch *sw, u16 *ruleset_id) { struct prestera_msg_acl_ruleset_resp resp; struct prestera_msg_acl_ruleset_req req; int err; err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_ACL_RULESET_CREATE, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *ruleset_id = __le16_to_cpu(resp.id); return 0; } int prestera_hw_acl_ruleset_del(struct prestera_switch *sw, u16 ruleset_id) { struct prestera_msg_acl_ruleset_req req = { .id = __cpu_to_le16(ruleset_id), }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_ACL_RULESET_DELETE, &req.cmd, sizeof(req)); } static int prestera_hw_acl_actions_put(struct prestera_msg_acl_action *action, struct prestera_acl_rule *rule) { struct list_head *a_list = prestera_acl_rule_action_list_get(rule); struct prestera_acl_rule_action_entry *a_entry; int i = 0; list_for_each_entry(a_entry, a_list, list) { action[i].id = __cpu_to_le32(a_entry->id); switch (a_entry->id) { case PRESTERA_ACL_RULE_ACTION_ACCEPT: case PRESTERA_ACL_RULE_ACTION_DROP: case PRESTERA_ACL_RULE_ACTION_TRAP: /* just rule action id, no specific data */ break; default: return -EINVAL; } i++; } return 0; } static int prestera_hw_acl_matches_put(struct prestera_msg_acl_match *match, struct prestera_acl_rule *rule) { struct list_head *m_list = prestera_acl_rule_match_list_get(rule); struct prestera_acl_rule_match_entry *m_entry; int i = 0; list_for_each_entry(m_entry, m_list, list) { match[i].type = __cpu_to_le32(m_entry->type); switch (m_entry->type) { case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_ETH_TYPE: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_L4_PORT_SRC: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_L4_PORT_DST: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_VLAN_ID: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_VLAN_TPID: match[i].keymask.u16.key = __cpu_to_le16(m_entry->keymask.u16.key); match[i].keymask.u16.mask = __cpu_to_le16(m_entry->keymask.u16.mask); break; case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_ICMP_TYPE: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_ICMP_CODE: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_IP_PROTO: match[i].keymask.u8.key = m_entry->keymask.u8.key; match[i].keymask.u8.mask = m_entry->keymask.u8.mask; break; case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_ETH_SMAC: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_ETH_DMAC: memcpy(match[i].keymask.mac.key, m_entry->keymask.mac.key, sizeof(match[i].keymask.mac.key)); memcpy(match[i].keymask.mac.mask, m_entry->keymask.mac.mask, sizeof(match[i].keymask.mac.mask)); break; case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_IP_SRC: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_IP_DST: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_L4_PORT_RANGE_SRC: case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_L4_PORT_RANGE_DST: match[i].keymask.u32.key = __cpu_to_le32(m_entry->keymask.u32.key); match[i].keymask.u32.mask = __cpu_to_le32(m_entry->keymask.u32.mask); break; case PRESTERA_ACL_RULE_MATCH_ENTRY_TYPE_PORT: match[i].keymask.u64.key = __cpu_to_le64(m_entry->keymask.u64.key); match[i].keymask.u64.mask = __cpu_to_le64(m_entry->keymask.u64.mask); break; default: return -EINVAL; } i++; } return 0; } int prestera_hw_acl_rule_add(struct prestera_switch *sw, struct prestera_acl_rule *rule, u32 *rule_id) { struct prestera_msg_acl_action *actions; struct prestera_msg_acl_match *matches; struct prestera_msg_acl_rule_resp resp; struct prestera_msg_acl_rule_req *req; u8 n_actions; u8 n_matches; void *buff; u32 size; int err; n_actions = prestera_acl_rule_action_len(rule); n_matches = prestera_acl_rule_match_len(rule); size = sizeof(*req) + sizeof(*actions) * n_actions + sizeof(*matches) * n_matches; buff = kzalloc(size, GFP_KERNEL); if (!buff) return -ENOMEM; req = buff; actions = buff + sizeof(*req); matches = buff + sizeof(*req) + sizeof(*actions) * n_actions; /* put acl actions into the message */ err = prestera_hw_acl_actions_put(actions, rule); if (err) goto free_buff; /* put acl matches into the message */ err = prestera_hw_acl_matches_put(matches, rule); if (err) goto free_buff; req->ruleset_id = __cpu_to_le16(prestera_acl_rule_ruleset_id_get(rule)); req->priority = __cpu_to_le32(prestera_acl_rule_priority_get(rule)); req->n_actions = prestera_acl_rule_action_len(rule); req->n_matches = prestera_acl_rule_match_len(rule); err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_ACL_RULE_ADD, &req->cmd, size, &resp.ret, sizeof(resp)); if (err) goto free_buff; *rule_id = __le32_to_cpu(resp.id); free_buff: kfree(buff); return err; } int prestera_hw_acl_rule_del(struct prestera_switch *sw, u32 rule_id) { struct prestera_msg_acl_rule_req req = { .id = __cpu_to_le32(rule_id) }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_ACL_RULE_DELETE, &req.cmd, sizeof(req)); } int prestera_hw_acl_rule_stats_get(struct prestera_switch *sw, u32 rule_id, u64 *packets, u64 *bytes) { struct prestera_msg_acl_rule_stats_resp resp; struct prestera_msg_acl_rule_req req = { .id = __cpu_to_le32(rule_id) }; int err; err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_ACL_RULE_STATS_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *packets = __le64_to_cpu(resp.packets); *bytes = __le64_to_cpu(resp.bytes); return 0; } int prestera_hw_acl_port_bind(const struct prestera_port *port, u16 ruleset_id) { struct prestera_msg_acl_ruleset_bind_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .ruleset_id = __cpu_to_le16(ruleset_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_ACL_PORT_BIND, &req.cmd, sizeof(req)); } int prestera_hw_acl_port_unbind(const struct prestera_port *port, u16 ruleset_id) { struct prestera_msg_acl_ruleset_bind_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .ruleset_id = __cpu_to_le16(ruleset_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_ACL_PORT_UNBIND, &req.cmd, sizeof(req)); } int prestera_hw_span_get(const struct prestera_port *port, u8 *span_id) { struct prestera_msg_span_resp resp; struct prestera_msg_span_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_SPAN_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *span_id = resp.id; return 0; } int prestera_hw_span_bind(const struct prestera_port *port, u8 span_id) { struct prestera_msg_span_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .id = span_id, }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_SPAN_BIND, &req.cmd, sizeof(req)); } int prestera_hw_span_unbind(const struct prestera_port *port) { struct prestera_msg_span_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_SPAN_UNBIND, &req.cmd, sizeof(req)); } int prestera_hw_span_release(struct prestera_switch *sw, u8 span_id) { struct prestera_msg_span_req req = { .id = span_id }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_SPAN_RELEASE, &req.cmd, sizeof(req)); } int prestera_hw_port_type_get(const struct prestera_port *port, u8 *type) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_TYPE), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; struct prestera_msg_port_attr_resp resp; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *type = resp.param.type; return 0; } int prestera_hw_port_speed_get(const struct prestera_port *port, u32 *speed) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_SPEED), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; struct prestera_msg_port_attr_resp resp; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *speed = __le32_to_cpu(resp.param.speed); return 0; } int prestera_hw_port_autoneg_restart(struct prestera_port *port) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_PHY_AUTONEG_RESTART), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_stats_get(const struct prestera_port *port, struct prestera_port_stats *st) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_STATS), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; struct prestera_msg_port_stats_resp resp; __le64 *hw = resp.stats; int err; err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; st->good_octets_received = __le64_to_cpu(hw[PRESTERA_PORT_GOOD_OCTETS_RCV_CNT]); st->bad_octets_received = __le64_to_cpu(hw[PRESTERA_PORT_BAD_OCTETS_RCV_CNT]); st->mac_trans_error = __le64_to_cpu(hw[PRESTERA_PORT_MAC_TRANSMIT_ERR_CNT]); st->broadcast_frames_received = __le64_to_cpu(hw[PRESTERA_PORT_BRDC_PKTS_RCV_CNT]); st->multicast_frames_received = __le64_to_cpu(hw[PRESTERA_PORT_MC_PKTS_RCV_CNT]); st->frames_64_octets = __le64_to_cpu(hw[PRESTERA_PORT_PKTS_64L_CNT]); st->frames_65_to_127_octets = __le64_to_cpu(hw[PRESTERA_PORT_PKTS_65TO127L_CNT]); st->frames_128_to_255_octets = __le64_to_cpu(hw[PRESTERA_PORT_PKTS_128TO255L_CNT]); st->frames_256_to_511_octets = __le64_to_cpu(hw[PRESTERA_PORT_PKTS_256TO511L_CNT]); st->frames_512_to_1023_octets = __le64_to_cpu(hw[PRESTERA_PORT_PKTS_512TO1023L_CNT]); st->frames_1024_to_max_octets = __le64_to_cpu(hw[PRESTERA_PORT_PKTS_1024TOMAXL_CNT]); st->excessive_collision = __le64_to_cpu(hw[PRESTERA_PORT_EXCESSIVE_COLLISIONS_CNT]); st->multicast_frames_sent = __le64_to_cpu(hw[PRESTERA_PORT_MC_PKTS_SENT_CNT]); st->broadcast_frames_sent = __le64_to_cpu(hw[PRESTERA_PORT_BRDC_PKTS_SENT_CNT]); st->fc_sent = __le64_to_cpu(hw[PRESTERA_PORT_FC_SENT_CNT]); st->fc_received = __le64_to_cpu(hw[PRESTERA_PORT_GOOD_FC_RCV_CNT]); st->buffer_overrun = __le64_to_cpu(hw[PRESTERA_PORT_DROP_EVENTS_CNT]); st->undersize = __le64_to_cpu(hw[PRESTERA_PORT_UNDERSIZE_PKTS_CNT]); st->fragments = __le64_to_cpu(hw[PRESTERA_PORT_FRAGMENTS_PKTS_CNT]); st->oversize = __le64_to_cpu(hw[PRESTERA_PORT_OVERSIZE_PKTS_CNT]); st->jabber = __le64_to_cpu(hw[PRESTERA_PORT_JABBER_PKTS_CNT]); st->rx_error_frame_received = __le64_to_cpu(hw[PRESTERA_PORT_MAC_RCV_ERROR_CNT]); st->bad_crc = __le64_to_cpu(hw[PRESTERA_PORT_BAD_CRC_CNT]); st->collisions = __le64_to_cpu(hw[PRESTERA_PORT_COLLISIONS_CNT]); st->late_collision = __le64_to_cpu(hw[PRESTERA_PORT_LATE_COLLISIONS_CNT]); st->unicast_frames_received = __le64_to_cpu(hw[PRESTERA_PORT_GOOD_UC_PKTS_RCV_CNT]); st->unicast_frames_sent = __le64_to_cpu(hw[PRESTERA_PORT_GOOD_UC_PKTS_SENT_CNT]); st->sent_multiple = __le64_to_cpu(hw[PRESTERA_PORT_MULTIPLE_PKTS_SENT_CNT]); st->sent_deferred = __le64_to_cpu(hw[PRESTERA_PORT_DEFERRED_PKTS_SENT_CNT]); st->good_octets_sent = __le64_to_cpu(hw[PRESTERA_PORT_GOOD_OCTETS_SENT_CNT]); return 0; } int prestera_hw_port_learning_set(struct prestera_port *port, bool enable) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_LEARNING), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .learning = enable, } }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } static int prestera_hw_port_uc_flood_set(struct prestera_port *port, bool flood) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_FLOOD), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .flood_ext = { .type = PRESTERA_PORT_FLOOD_TYPE_UC, .enable = flood, } } }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } static int prestera_hw_port_mc_flood_set(struct prestera_port *port, bool flood) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_FLOOD), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .flood_ext = { .type = PRESTERA_PORT_FLOOD_TYPE_MC, .enable = flood, } } }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } static int prestera_hw_port_flood_set_v2(struct prestera_port *port, bool flood) { struct prestera_msg_port_attr_req req = { .attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_FLOOD), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .param = { .flood = flood, } }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, &req.cmd, sizeof(req)); } int prestera_hw_port_flood_set(struct prestera_port *port, unsigned long mask, unsigned long val) { int err; if (port->sw->dev->fw_rev.maj <= 2) { if (!(mask & BR_FLOOD)) return 0; return prestera_hw_port_flood_set_v2(port, val & BR_FLOOD); } if (mask & BR_FLOOD) { err = prestera_hw_port_uc_flood_set(port, val & BR_FLOOD); if (err) goto err_uc_flood; } if (mask & BR_MCAST_FLOOD) { err = prestera_hw_port_mc_flood_set(port, val & BR_MCAST_FLOOD); if (err) goto err_mc_flood; } return 0; err_mc_flood: prestera_hw_port_mc_flood_set(port, 0); err_uc_flood: if (mask & BR_FLOOD) prestera_hw_port_uc_flood_set(port, 0); return err; } int prestera_hw_vlan_create(struct prestera_switch *sw, u16 vid) { struct prestera_msg_vlan_req req = { .vid = __cpu_to_le16(vid), }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_VLAN_CREATE, &req.cmd, sizeof(req)); } int prestera_hw_vlan_delete(struct prestera_switch *sw, u16 vid) { struct prestera_msg_vlan_req req = { .vid = __cpu_to_le16(vid), }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_VLAN_DELETE, &req.cmd, sizeof(req)); } int prestera_hw_vlan_port_set(struct prestera_port *port, u16 vid, bool is_member, bool untagged) { struct prestera_msg_vlan_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .vid = __cpu_to_le16(vid), .is_member = is_member, .is_tagged = !untagged, }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_VLAN_PORT_SET, &req.cmd, sizeof(req)); } int prestera_hw_vlan_port_vid_set(struct prestera_port *port, u16 vid) { struct prestera_msg_vlan_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .vid = __cpu_to_le16(vid), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_VLAN_PVID_SET, &req.cmd, sizeof(req)); } int prestera_hw_vlan_port_stp_set(struct prestera_port *port, u16 vid, u8 state) { struct prestera_msg_stp_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .vid = __cpu_to_le16(vid), .state = state, }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_STP_PORT_SET, &req.cmd, sizeof(req)); } int prestera_hw_fdb_add(struct prestera_port *port, const unsigned char *mac, u16 vid, bool dynamic) { struct prestera_msg_fdb_req req = { .dest = { .dev = __cpu_to_le32(port->dev_id), .port = __cpu_to_le32(port->hw_id), }, .vid = __cpu_to_le16(vid), .dynamic = dynamic, }; ether_addr_copy(req.mac, mac); return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_ADD, &req.cmd, sizeof(req)); } int prestera_hw_fdb_del(struct prestera_port *port, const unsigned char *mac, u16 vid) { struct prestera_msg_fdb_req req = { .dest = { .dev = __cpu_to_le32(port->dev_id), .port = __cpu_to_le32(port->hw_id), }, .vid = __cpu_to_le16(vid), }; ether_addr_copy(req.mac, mac); return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_DELETE, &req.cmd, sizeof(req)); } int prestera_hw_lag_fdb_add(struct prestera_switch *sw, u16 lag_id, const unsigned char *mac, u16 vid, bool dynamic) { struct prestera_msg_fdb_req req = { .dest_type = PRESTERA_HW_FDB_ENTRY_TYPE_LAG, .dest = { .lag_id = __cpu_to_le16(lag_id), }, .vid = __cpu_to_le16(vid), .dynamic = dynamic, }; ether_addr_copy(req.mac, mac); return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_ADD, &req.cmd, sizeof(req)); } int prestera_hw_lag_fdb_del(struct prestera_switch *sw, u16 lag_id, const unsigned char *mac, u16 vid) { struct prestera_msg_fdb_req req = { .dest_type = PRESTERA_HW_FDB_ENTRY_TYPE_LAG, .dest = { .lag_id = __cpu_to_le16(lag_id), }, .vid = __cpu_to_le16(vid), }; ether_addr_copy(req.mac, mac); return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_DELETE, &req.cmd, sizeof(req)); } int prestera_hw_fdb_flush_port(struct prestera_port *port, u32 mode) { struct prestera_msg_fdb_req req = { .dest = { .dev = __cpu_to_le32(port->dev_id), .port = __cpu_to_le32(port->hw_id), }, .flush_mode = __cpu_to_le32(mode), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT, &req.cmd, sizeof(req)); } int prestera_hw_fdb_flush_vlan(struct prestera_switch *sw, u16 vid, u32 mode) { struct prestera_msg_fdb_req req = { .vid = __cpu_to_le16(vid), .flush_mode = __cpu_to_le32(mode), }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_FLUSH_VLAN, &req.cmd, sizeof(req)); } int prestera_hw_fdb_flush_port_vlan(struct prestera_port *port, u16 vid, u32 mode) { struct prestera_msg_fdb_req req = { .dest = { .dev = __cpu_to_le32(port->dev_id), .port = __cpu_to_le32(port->hw_id), }, .vid = __cpu_to_le16(vid), .flush_mode = __cpu_to_le32(mode), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT_VLAN, &req.cmd, sizeof(req)); } int prestera_hw_fdb_flush_lag(struct prestera_switch *sw, u16 lag_id, u32 mode) { struct prestera_msg_fdb_req req = { .dest_type = PRESTERA_HW_FDB_ENTRY_TYPE_LAG, .dest = { .lag_id = __cpu_to_le16(lag_id), }, .flush_mode = __cpu_to_le32(mode), }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT, &req.cmd, sizeof(req)); } int prestera_hw_fdb_flush_lag_vlan(struct prestera_switch *sw, u16 lag_id, u16 vid, u32 mode) { struct prestera_msg_fdb_req req = { .dest_type = PRESTERA_HW_FDB_ENTRY_TYPE_LAG, .dest = { .lag_id = __cpu_to_le16(lag_id), }, .vid = __cpu_to_le16(vid), .flush_mode = __cpu_to_le32(mode), }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT_VLAN, &req.cmd, sizeof(req)); } int prestera_hw_bridge_create(struct prestera_switch *sw, u16 *bridge_id) { struct prestera_msg_bridge_resp resp; struct prestera_msg_bridge_req req; int err; err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_BRIDGE_CREATE, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *bridge_id = __le16_to_cpu(resp.bridge); return 0; } int prestera_hw_bridge_delete(struct prestera_switch *sw, u16 bridge_id) { struct prestera_msg_bridge_req req = { .bridge = __cpu_to_le16(bridge_id), }; return prestera_cmd(sw, PRESTERA_CMD_TYPE_BRIDGE_DELETE, &req.cmd, sizeof(req)); } int prestera_hw_bridge_port_add(struct prestera_port *port, u16 bridge_id) { struct prestera_msg_bridge_req req = { .bridge = __cpu_to_le16(bridge_id), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_BRIDGE_PORT_ADD, &req.cmd, sizeof(req)); } int prestera_hw_bridge_port_delete(struct prestera_port *port, u16 bridge_id) { struct prestera_msg_bridge_req req = { .bridge = __cpu_to_le16(bridge_id), .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_BRIDGE_PORT_DELETE, &req.cmd, sizeof(req)); } int prestera_hw_rxtx_init(struct prestera_switch *sw, struct prestera_rxtx_params *params) { struct prestera_msg_rxtx_resp resp; struct prestera_msg_rxtx_req req; int err; req.use_sdma = params->use_sdma; err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_RXTX_INIT, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; params->map_addr = __le32_to_cpu(resp.map_addr); return 0; } int prestera_hw_lag_member_add(struct prestera_port *port, u16 lag_id) { struct prestera_msg_lag_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .lag_id = __cpu_to_le16(lag_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_LAG_MEMBER_ADD, &req.cmd, sizeof(req)); } int prestera_hw_lag_member_del(struct prestera_port *port, u16 lag_id) { struct prestera_msg_lag_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .lag_id = __cpu_to_le16(lag_id), }; return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_LAG_MEMBER_DELETE, &req.cmd, sizeof(req)); } int prestera_hw_lag_member_enable(struct prestera_port *port, u16 lag_id, bool enable) { struct prestera_msg_lag_req req = { .port = __cpu_to_le32(port->hw_id), .dev = __cpu_to_le32(port->dev_id), .lag_id = __cpu_to_le16(lag_id), }; u32 cmd; cmd = enable ? PRESTERA_CMD_TYPE_LAG_MEMBER_ENABLE : PRESTERA_CMD_TYPE_LAG_MEMBER_DISABLE; return prestera_cmd(port->sw, cmd, &req.cmd, sizeof(req)); } int prestera_hw_cpu_code_counters_get(struct prestera_switch *sw, u8 code, enum prestera_hw_cpu_code_cnt_t counter_type, u64 *packet_count) { struct prestera_msg_cpu_code_counter_req req = { .counter_type = counter_type, .code = code, }; struct mvsw_msg_cpu_code_counter_ret resp; int err; err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_CPU_CODE_COUNTERS_GET, &req.cmd, sizeof(req), &resp.ret, sizeof(resp)); if (err) return err; *packet_count = __le64_to_cpu(resp.packet_count); return 0; } int prestera_hw_event_handler_register(struct prestera_switch *sw, enum prestera_event_type type, prestera_event_cb_t fn, void *arg) { struct prestera_fw_event_handler *eh; eh = __find_event_handler(sw, type); if (eh) return -EEXIST; eh = kmalloc(sizeof(*eh), GFP_KERNEL); if (!eh) return -ENOMEM; eh->type = type; eh->func = fn; eh->arg = arg; INIT_LIST_HEAD(&eh->list); list_add_rcu(&eh->list, &sw->event_handlers); return 0; } void prestera_hw_event_handler_unregister(struct prestera_switch *sw, enum prestera_event_type type, prestera_event_cb_t fn) { struct prestera_fw_event_handler *eh; eh = __find_event_handler(sw, type); if (!eh) return; list_del_rcu(&eh->list); kfree_rcu(eh, rcu); }
24.976854
81
0.749226
a16ee1dd951cc829b38a5cb6a102222a143af2d3
12,286
h
C
src/dockapps/libdockapp/src/dockapp.h
kevingnet/fvwm_themed
e6c2aa4526d592d66261ac0579fd74d056d480fb
[ "MIT" ]
2
2020-02-10T11:48:41.000Z
2020-02-10T12:58:00.000Z
src/dockapps/libdockapp/src/dockapp.h
kevingnet/fvwm_themed
e6c2aa4526d592d66261ac0579fd74d056d480fb
[ "MIT" ]
null
null
null
src/dockapps/libdockapp/src/dockapp.h
kevingnet/fvwm_themed
e6c2aa4526d592d66261ac0579fd74d056d480fb
[ "MIT" ]
null
null
null
/* * Copyright (c) 1999-2005 Alfredo K. Kojima, Alban Hertroys * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _DOCKAPP_H_ #define _DOCKAPP_H_ #define DA_VERSION 20050716 /* * This is a simple (trivial) library for writing Window Maker dock * applications, or dockapps (those that only show up in the dock), easily. * * It is very limited and can be only used for dockapps that open a single * appicon for process in only ibe single display, but this seems to be * enough for most, if not all, dockapps. */ #include <X11/Xlib.h> #include <X11/Xresource.h> #include <X11/xpm.h> #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <unistd.h> /* class-name for X-resources and Window Maker attributes */ #define RES_CLASSNAME "DockApp" /* !!! DEPRECATED !!! * This feature may be removed in the future. Use DAEventCallbacks instead. * * the callbacks for events related to the dockapp window your program wants * to handle */ typedef struct { /* the dockapp window was destroyed */ void (*destroy)(void); /* button pressed */ void (*buttonPress)(int button, int state, int x, int y); /* button released */ void (*buttonRelease)(int button, int state, int x, int y); /* pointer motion */ void (*motion)(int x, int y); /* pointer entered dockapp window */ void (*enter)(void); /* pointer left dockapp window */ void (*leave)(void); /* timer expired */ void (*timeout)(void); } DACallbacks; typedef struct { char *shortForm; /* short form for option, like -w */ char *longForm; /* long form for option, like --withdrawn */ char *description; /* description for the option */ short type; /* type of argument */ Bool used; /* if the argument was passed on the cmd-line */ /* the following are only set if the "used" field is True */ union { void *ptr; /* a ptr for the value that was passed */ int *integer; /* on the command line */ char **string; } value; } DAProgramOption; typedef XRectangle DARect; /* * A callback function for an event on an "action rectangle" */ typedef void DARectCallback(int x, int y, DARect rect, void *data); /* * The action rectangle structure */ typedef struct { DARect rect; DARectCallback *action; } DAActionRect; /* option argument types */ enum { DONone, /* simple on/off flag */ DOInteger, /* an integer number */ DOString, /* a string */ DONatural /* positive integer number */ }; /* Shaped pixmaps: Shapes in combination with pixmaps */ typedef struct { Pixmap pixmap; Pixmap shape; /* needs a 1-bit plane GC (shapeGC). */ GC drawGC, clearGC, shapeGC; DARect geometry; /* position and size */ DAActionRect *triggers; } DAShapedPixmap; extern Display *DADisplay; extern Window DAWindow, DALeader, DAIcon; /* see [NOTE] */ extern int DADepth; extern Visual *DAVisual; extern GC DAGC, DAClearGC; extern DARect DANoRect; extern unsigned long DAExpectedVersion; /* [NOTE] * DALeader is the group-leader window, DAIcon is the icon window. * DAWindow is the one of these two that is visible. Depending on whether the * dockapp was started normally or windowed, that will be DAIcon and DALeader * respectively. * DAIcon is None if the dockapp runs in "windowed mode". */ /* * Set the version of the library that the dockapp expects. * This is a date in the format 'yyyymmdd'. You can find this date * in NEWS. */ void DASetExpectedVersion(unsigned long expectedVersion); /* * DAParseArguments- * Command line arguments parser. The program is exited if there are * syntax errors. * * -h, --help and --version are automatically handled (causing the program * to exit) * -w is handled automatically as well and causes the dockapp to be run * in windowed mode. */ void DAParseArguments(int argc, char **argv, DAProgramOption *options, int count, char *programDescription, char *versionDescription); /* * DAInitialize- * Initialize the dockapp, open a connection to the X Server, * create the needed windows and set them up to become an appicon window. * It will automatically detect if Window Maker is present and use * an appropriate window form. * * You must call this always before calling anything else (except for * DAParseArguments()) * * Arguments: * display - the name of the display to connect to. * Use "" to use the default value. * name - the name of your dockapp, used as the instance name * for the WM_CLASS hint. Like wmyaclock. * The ClassName is set to "DockApp" on default. * width, height - the size of the dockapp window. 48x48 is the * preferred size. * argc, argc - the program arguments. argv[0] will be used * as the instance name for the WM_CLASS hint. */ void DAInitialize(char *display, char *name, unsigned width, unsigned height, int argc, char **argv); void DAOpenDisplay(char *display, int argc, char **argv); void DACreateIcon(char *name, unsigned width, unsigned height, int argc, char **argv); void DAProposeIconSize(unsigned width, unsigned height); /* * Wrapper functions for global variables. */ /* Get/Set DADisplay value. For use with external code. * Call with NULL as only argument. Other arguments are for backward compatibility * only. * XXX: Argument list is a kludge. */ Display *DAGetDisplay(char *d, ...); void DASetDisplay(Display *display); /* Get program name (from argv[0]). Returns a reference. */ char *DAGetProgramName(); /* Get/Set DAWindow and DALeader values respectively. For use with external code. */ Window DAGetWindow(void); void DASetWindow(Window window); Window DAGetLeader(void); void DASetLeader(Window leader); Window DAGetIconWindow(void); void DASetIconWindow(Window icon_win); /* Get/Set DADepth; the display depth. For use with external code. */ int DAGetDepth(void); void DASetDepth(int depth); /* Get/Set DAVisual; the visual type for the screen. For use with external code. */ Visual *DAGetVisual(void); void DASetVisual(Visual *visual); /* * DASetShapeWithOffset- * Sets the shape mask of the dockapp to the specified one. This is * optional. If you pass None as shapeMask, the dockapp will become * non-shaped. * * This is only needed if you want the dockapp to be shaped. */ #define DASetShape(shapeMask) \ (DASetShapeWithOffset((shapeMask), 0, 0)) #define DASetShapeForWindow(window, shapeMask) \ (DASetShapeWithOffsetForWindow((window), (shapeMask), 0, 0)) void DASetShapeWithOffset(Pixmap shapeMask, int x_ofs, int y_ofs); void DASetShapeWithOffsetForWindow(Window window, Pixmap shapeMask, int x_ofs, int y_ofs); /* * DASetPixmap- * Sets the image pixmap for the dockapp. Once you set the image with it, * you don't need to handle expose events. */ void DASetPixmap(Pixmap pixmap); void DASetPixmapForWindow(Window window, Pixmap pixmap); /* * DAMakePixmap- * Creates a pixmap suitable for use with DASetPixmap() */ Pixmap DAMakePixmap(void); /* * DAMakeShape- * Creates a shape pixmap suitable for use with DASetShape() */ Pixmap DAMakeShape(void); /* * DAMakeShapeFromData- * Creates a shape pixmap suitable for use with DASetShape() from XBM data. */ Pixmap DAMakeShapeFromData(char *data, unsigned int width, unsigned int height); /* * DAMakeShapeFromFile- * Creates a shape pixmap suitable for use with DASetShape() from an * XBM file. */ Pixmap DAMakeShapeFromFile(char *filename); /* * DAMakePixmapFromData- * Creates a pixmap and mask from XPM data * Returns true on success, false on failure. */ Bool DAMakePixmapFromData(char **data, Pixmap *pixmap, Pixmap *mask, unsigned short *width, unsigned short *height); /* * DAMakePixmapFromFile- * Creates a pixmap and mask from an XPM file * Returns true on success, false on failure. */ Bool DAMakePixmapFromFile(char *filename, Pixmap *pixmap, Pixmap *mask, unsigned short *width, unsigned short *height); /* * DAMakeShapedPixmap- * Creates a shaped pixmap with width & height of dockapp window. */ DAShapedPixmap *DAMakeShapedPixmap(); /* * DAMakeShapedPixmapFromData- * Creates a shaped pixmap from XPM-data. * Returns shaped pixmap on success, NULL on failure. */ DAShapedPixmap *DAMakeShapedPixmapFromData(char **data); /* * DAMakeShapedPixmapFromFile- * Creates a shaped pixmap from an XPM file. * Returns shaped pixmap on success, NULL on failure. */ DAShapedPixmap *DAMakeShapedPixmapFromFile(char *filename); /* * DAFreeShapedPixmap- * Free memory reserved for a ShapedPixmap */ void DAFreeShapedPixmap(DAShapedPixmap *dasp); /* * DASPCopyArea- * Copies shape-mask and pixmap-data from an area in one shaped pixmap * into another shaped pixmap. */ void DASPCopyArea(DAShapedPixmap *src, DAShapedPixmap *dst, int x1, int y1, int w, int h, int x2, int y2); /* * DASPClear- * Clears a shaped pixmaps contents. */ void DASPClear(DAShapedPixmap *dasp); /* DASPShow- * Displays the pixmap in the dockapp-window. */ void DASPSetPixmap(DAShapedPixmap *dasp); void DASPSetPixmapForWindow(Window window, DAShapedPixmap *dasp); /* * DAGetColor- * Returns an X color index. */ unsigned long DAGetColor(char *colorName); /* * DAShow- * Displays the dockapp. * * Always call this function or the dockapp won't show up. */ void DAShow(void); /* * DAShowWindow- * Display a window. Also displays subwindows if it is the dockapp leader * window (DALeader). */ void DAShowWindow(Window window); /* * DASetCallbacks- * Register a set of callbacks for events like mouse clicks. * * Only needed if you want to receive some event. */ void DASetCallbacks(DACallbacks *callbacks); /* * DASetTimeout- * Sets a timeout for the DAEventLoop(). The timeout callback * will be called whenever the app doesn't get any events from the * X server in the specified time. */ void DASetTimeout(int milliseconds); /* * DANextEventOrTimeout- * Waits until a event is received or the timeout limit has * expired. Returns True if an event was received. */ Bool DANextEventOrTimeout(XEvent *event, unsigned long milliseconds); /* * DAProcessEvent- * Processes an event. Returns True if the event was handled and * False otherwise. * * Must be called from your event loop, unless you use DAEventLoop() */ Bool DAProcessEvent(XEvent *event); Bool DAProcessEventForWindow(Window window, XEvent *event); /* * DAEventLoop- * Enters an event loop where events are processed until the dockapp * is closed. This function never returns. */ void DAEventLoop(void); void DAEventLoopForWindow(Window window); /* * DAProcessActionRects- * Processes the current coordinates with one of the functions in * the array of action rectangles. Coordinates are converted to relative * coordinates in one of the rectangles. The last item in the array of * action rectangles must be NULL. */ void DAProcessActionRects(int x, int y, DAActionRect *actionrects, int count, void *data); /* * Error handling functions */ /* Print a warning to stderr and continue */ void DAWarning(const char *fmt, ...); /* Print an error to stderr and exit with 1 */ void DAError(const char *fmt, ...); #endif
28.840376
84
0.714553
712ad708a35bf55000e8b4aee74bb34740da1e04
395
ts
TypeScript
src/components/SvgIcon/styles.ts
diegoasanch/Estadistica_General
ab9f4a3356c4abeeb410576974cdad88adbbacdb
[ "MIT" ]
1
2021-05-13T21:23:36.000Z
2021-05-13T21:23:36.000Z
src/components/SvgIcon/styles.ts
diegoasanch/Estadistica_General
ab9f4a3356c4abeeb410576974cdad88adbbacdb
[ "MIT" ]
3
2021-04-26T18:27:13.000Z
2021-04-28T21:38:01.000Z
src/components/SvgIcon/styles.ts
diegoasanch/Estadistica_General
ab9f4a3356c4abeeb410576974cdad88adbbacdb
[ "MIT" ]
1
2021-06-21T23:53:21.000Z
2021-06-21T23:53:21.000Z
import styled from 'styled-components' type InlineProps = { width?: string heigth?: string } const InlineSvg = styled.svg<InlineProps>` height: ${(props) => props.height ?? '1.5em'}; vertical-align: text-bottom; ` const InlineImg = styled.img<InlineProps>` height: ${(props) => props.height ?? '1.5em'}; vertical-align: text-bottom; ` export { InlineSvg, InlineImg }
20.789474
50
0.658228
15e425518e13c78d42eb8c945a664eda28a9d2cc
1,474
rb
Ruby
app/models/classic.rb
David-P-Molina/classic_literature_yoda_translator
94da2d3300a6dffea041e0d7e2bf28dbf926a35f
[ "MIT" ]
null
null
null
app/models/classic.rb
David-P-Molina/classic_literature_yoda_translator
94da2d3300a6dffea041e0d7e2bf28dbf926a35f
[ "MIT" ]
null
null
null
app/models/classic.rb
David-P-Molina/classic_literature_yoda_translator
94da2d3300a6dffea041e0d7e2bf28dbf926a35f
[ "MIT" ]
null
null
null
class Classic < ApplicationRecord belongs_to :author belongs_to :category belongs_to :user validates :title, presence: true validates :release_date, presence: true validate :classic_must_be_older_than_25_years #scope methods scope :sixteen_hundred_classic, -> { where("1600 < release_date")} scope :seventeen_hundred_classic, -> { where("release_date < 1700")} scope :modern_classic, -> { where("release_date > 1700")} scope :ancient_classic, -> { where("release_date < 1699")} def self.newest_classic Classic.order(:release_date).reverse_order.first end def self.oldest_classic Classic.order(:release_date).first end #Name helpers def category_name=(name) self.category = Category.find_or_create_by(name: name) end def category_name self.category.try(:name) end def author_name=(name) self.author = Author.find_or_create_by(name: name) end def author_name self.author.try(:name) end #Custom Validations def classic_must_be_older_than_25_years if release_date.present? && release_date > Date.today.year - 25 errors.add(:release_date, "Literature must be at least 25 years old!") end end def author_attributes=(attributes) if !attributes["name"].blank? && !attributes["biography"].blank? self.author = Author.find_or_create_by(attributes) end end end
30.708333
82
0.674355
f769f68548ee87e059aad3fae1baff4b582407e5
1,871
h
C
PrivateFrameworks/QuickLookThumbnailing/QLThumbnailVersion.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/QuickLookThumbnailing/QLThumbnailVersion.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/QuickLookThumbnailing/QLThumbnailVersion.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" #import "NSSecureCoding.h" @class NSData, NSDate, NSString; @interface QLThumbnailVersion : NSObject <NSSecureCoding> { NSDate *_modificationDate; unsigned long long _fileSize; NSString *_generatorID; NSString *_generatorVersion; NSData *_versionIdentifier; } + (BOOL)supportsSecureCoding; @property(copy) NSData *versionIdentifier; // @synthesize versionIdentifier=_versionIdentifier; @property unsigned long long fileSize; // @synthesize fileSize=_fileSize; @property(copy) NSDate *modificationDate; // @synthesize modificationDate=_modificationDate; @property(copy) NSString *generatorVersion; // @synthesize generatorVersion=_generatorVersion; @property(copy) NSString *generatorID; // @synthesize generatorID=_generatorID; - (void).cxx_destruct; - (unsigned long long)hash; - (BOOL)isEqual:(id)arg1; - (id)description; @property(readonly, getter=isDefaultVersion) BOOL defaultVersion; @property(readonly, getter=isAutomaticallyGenerated) BOOL automaticallyGenerated; - (BOOL)shouldBeInvalidatedByThumbnailWithVersion:(id)arg1; - (id)initWithDictionaryRepresentation:(id)arg1; - (id)dictionaryRepresentation; - (id)initWithCoder:(id)arg1; - (void)encodeWithCoder:(id)arg1; - (id)initWithFPItem:(id)arg1 automaticallyGenerated:(BOOL)arg2; - (id)initWithFileURL:(id)arg1 automaticallyGenerated:(BOOL)arg2; - (void)getGeneratorID:(id *)arg1 version:(id *)arg2; - (id)initWithFPItem:(id)arg1 generatorID:(id)arg2 generatorVersion:(id)arg3; - (id)initWithFileURL:(id)arg1 generatorID:(id)arg2 generatorVersion:(id)arg3; - (id)initWithModificationDate:(id)arg1 fileSize:(unsigned long long)arg2 versionIdentifier:(id)arg3 generatorID:(id)arg4 generatorVersion:(id)arg5; - (id)init; @end
38.183673
148
0.773918
71bd2e4c7f196cc527de28615ccb772cdef572d6
3,306
kt
Kotlin
nugu-client-kit/src/main/java/com/skt/nugu/sdk/client/channel/DefaultFocusChannel.kt
Taehui/nugu-android
1a87da453309296864753d6212f8d9ce17ce2bf3
[ "Apache-2.0" ]
1
2019-10-17T07:24:45.000Z
2019-10-17T07:24:45.000Z
nugu-client-kit/src/main/java/com/skt/nugu/sdk/client/channel/DefaultFocusChannel.kt
Taehui/nugu-android
1a87da453309296864753d6212f8d9ce17ce2bf3
[ "Apache-2.0" ]
null
null
null
nugu-client-kit/src/main/java/com/skt/nugu/sdk/client/channel/DefaultFocusChannel.kt
Taehui/nugu-android
1a87da453309296864753d6212f8d9ce17ce2bf3
[ "Apache-2.0" ]
null
null
null
/** * Copyright (c) 2019 SK Telecom Co., Ltd. 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 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.skt.nugu.sdk.client.channel import com.skt.nugu.sdk.core.interfaces.focus.FocusManagerInterface class DefaultFocusChannel { companion object { // If you add other channel, only allow to use positive number for priority const val INTRUSION_CHANNEL_NAME = "Intrusion" const val INTRUSION_CHANNEL_PRIORITY = 50 const val DIALOG_CHANNEL_NAME = "Dialog" const val DIALOG_CHANNEL_PRIORITY = 100 const val COMMUNICATIONS_CHANNEL_NAME = "Communications" const val COMMUNICATIONS_CHANNEL_PRIORITY = 150 const val ALERTS_CHANNEL_NAME = "Alerts" const val ALERTS_CHANNEL_PRIORITY = 200 const val CONTENT_CHANNEL_NAME = "Content" const val CONTENT_CHANNEL_PRIORITY = 300 fun getDefaultAudioChannels(): List<FocusManagerInterface.ChannelConfiguration> { return listOf( FocusManagerInterface.ChannelConfiguration( INTRUSION_CHANNEL_NAME, INTRUSION_CHANNEL_PRIORITY, true), FocusManagerInterface.ChannelConfiguration( DIALOG_CHANNEL_NAME, DIALOG_CHANNEL_PRIORITY ), FocusManagerInterface.ChannelConfiguration( COMMUNICATIONS_CHANNEL_NAME, COMMUNICATIONS_CHANNEL_PRIORITY ), FocusManagerInterface.ChannelConfiguration( ALERTS_CHANNEL_NAME, ALERTS_CHANNEL_PRIORITY ), FocusManagerInterface.ChannelConfiguration( CONTENT_CHANNEL_NAME, CONTENT_CHANNEL_PRIORITY ) ) } fun getDefaultVisualChannels(): List<FocusManagerInterface.ChannelConfiguration> { return listOf( FocusManagerInterface.ChannelConfiguration( INTRUSION_CHANNEL_NAME, INTRUSION_CHANNEL_PRIORITY, true), FocusManagerInterface.ChannelConfiguration( DIALOG_CHANNEL_NAME, DIALOG_CHANNEL_PRIORITY, true), FocusManagerInterface.ChannelConfiguration( COMMUNICATIONS_CHANNEL_NAME, COMMUNICATIONS_CHANNEL_PRIORITY, true), FocusManagerInterface.ChannelConfiguration( ALERTS_CHANNEL_NAME, ALERTS_CHANNEL_PRIORITY, true), FocusManagerInterface.ChannelConfiguration( CONTENT_CHANNEL_NAME, CONTENT_CHANNEL_PRIORITY, true) ) } } }
42.384615
90
0.632184
0a097baa41ac337d49e83084a248f6a18260547f
2,061
ts
TypeScript
src/lib/critical_path/critical_path.ts
smoogly/tasklauncher
2264c08f7cd5a8350f060e56008e63de5c044a9d
[ "MIT" ]
3
2021-11-22T09:04:44.000Z
2022-03-04T07:58:14.000Z
src/lib/critical_path/critical_path.ts
smoogly/tasklauncher
2264c08f7cd5a8350f060e56008e63de5c044a9d
[ "MIT" ]
null
null
null
src/lib/critical_path/critical_path.ts
smoogly/tasklauncher
2264c08f7cd5a8350f060e56008e63de5c044a9d
[ "MIT" ]
1
2022-02-14T17:40:10.000Z
2022-02-14T17:40:10.000Z
import { AnyInput, Task } from "../work_api"; import { Execution } from "../execution"; import { Stats, TaskExecutionStat } from "../parallelize"; import { alignDurations, formatDuration } from "../util/time"; export type CritPathExpectedTaskShape = Task<AnyInput, Execution & { duration: Promise<number | null> }> & { taskName: string }; export async function criticalPath(executionStats: Stats<TaskExecutionStat<CritPathExpectedTaskShape>>) { if (depth(executionStats) < 2) { return null; } // Ignore all-parallel task trees const path = calculateCriticalPath(await extractTaskDurations(executionStats)); const totalDuration = formatDuration(path.reduce((tot, stat) => tot + stat.duration, 0)); const align = alignDurations(path.map(({ duration }) => duration)); const pathStr = path.reverse().map(({ name, duration }) => `${ align(duration) } ${ name }`).join("\n"); return { totalDuration, pathStr }; } type Durations = Stats<{ name: string, duration: number }>; export async function extractTaskDurations(stats: Stats<TaskExecutionStat<CritPathExpectedTaskShape>>): Promise<Durations> { const [duration, dependencies] = await Promise.all([stats.stats?.output.duration, Promise.all(stats.dependencies.map(extractTaskDurations))]); return { stats: stats.stats && duration ? { name: stats.stats.task.taskName, duration } : null, dependencies, }; } export function depth(stats: Stats<unknown>): number { const ownIncrement = stats.stats === null ? 0 : 1; return stats.dependencies.map(depth).reduce((a, b) => Math.max(a, b), 0) + ownIncrement; } export function calculateCriticalPath(stats: Durations): { name: string, duration: number }[] { const tail = !stats.dependencies.length ? [] : stats.dependencies .map(calculateCriticalPath) .map(path => ({ path, duration: path.reduce((tot, step) => tot + step.duration, 0) })) .reduce((a, b) => a.duration > b.duration ? a : b) .path; if (!stats.stats) { return tail; } return [stats.stats, ...tail]; }
49.071429
146
0.683649
0302b31e20ba0e4fdf87f314b0520b7847c6eeb1
7,258
lua
Lua
MMOCoreORB/bin/scripts/object/custom_content/draft_schematic/space/engine/objects.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
18
2017-02-09T15:36:05.000Z
2021-12-21T04:22:15.000Z
MMOCoreORB/bin/scripts/object/custom_content/draft_schematic/space/engine/objects.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
61
2016-12-30T21:51:10.000Z
2021-12-10T20:25:56.000Z
MMOCoreORB/bin/scripts/object/custom_content/draft_schematic/space/engine/objects.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
71
2017-01-01T05:34:38.000Z
2022-03-29T01:04:00.000Z
object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk1 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk1.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk1, "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk1.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk2.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk2, "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk2.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk3 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk3.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk3, "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk3.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk4 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk4.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk4, "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk4.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk5 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk5.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_collection_reward_engine_01_mk5, "object/draft_schematic/space/engine/shared_collection_reward_engine_01_mk5.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_elite_engine = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_elite_engine.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_elite_engine, "object/draft_schematic/space/engine/shared_elite_engine.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_engine_overhaul_mk1 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_engine_overhaul_mk1.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_engine_overhaul_mk1, "object/draft_schematic/space/engine/shared_engine_overhaul_mk1.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_engine_overhaul_mk2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_engine_overhaul_mk2.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_engine_overhaul_mk2, "object/draft_schematic/space/engine/shared_engine_overhaul_mk2.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_engine_stabilizer_mk1 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_engine_stabilizer_mk1.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_engine_stabilizer_mk1, "object/draft_schematic/space/engine/shared_engine_stabilizer_mk1.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_engine_stabilizer_mk2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_engine_stabilizer_mk2.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_engine_stabilizer_mk2, "object/draft_schematic/space/engine/shared_engine_stabilizer_mk2.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_eng_elite_mk2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_eng_elite_mk2.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_eng_elite_mk2, "object/draft_schematic/space/engine/shared_eng_elite_mk2.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_eng_reward_experimental = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_eng_reward_experimental.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_eng_reward_experimental, "object/draft_schematic/space/engine/shared_eng_reward_experimental.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_nova_eng_01 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_nova_eng_01.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_nova_eng_01, "object/draft_schematic/space/engine/shared_nova_eng_01.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_engine_shared_orion_eng_01 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/engine/shared_orion_eng_01.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_engine_shared_orion_eng_01, "object/draft_schematic/space/engine/shared_orion_eng_01.iff") ------------------------------------------------------------------------------------------------------------------------------------
64.230088
191
0.672086
9c24f119c0b0aa35beb278c3f7c59c8307b25645
1,698
js
JavaScript
Cosmose Server/src/services/faceapi_service.js
wearespacey/Cosmose
0863bf2d1eb3fd5f7112d0612a34f7e1e9a3f2d9
[ "MIT" ]
null
null
null
Cosmose Server/src/services/faceapi_service.js
wearespacey/Cosmose
0863bf2d1eb3fd5f7112d0612a34f7e1e9a3f2d9
[ "MIT" ]
null
null
null
Cosmose Server/src/services/faceapi_service.js
wearespacey/Cosmose
0863bf2d1eb3fd5f7112d0612a34f7e1e9a3f2d9
[ "MIT" ]
null
null
null
const KEY = "49c7cc03467545c0997f97b765134be4"; const axios = require('axios'); var atob = require('atob'); class FaceApiService{ constructor(){ } async addFace(base64Image, personGroupId, personId){ // var data = IMAGE_FROM_AZURE.split(',')[1]; // var mimeType = IMAGE_FROM_AZURE.split(';')[0].slice(5) // var bytes = window.atob(data); // var buf = new ArrayBuffer(bytes.length); // var byteArr = new Uint8Array(buf); // for (var i = 0; i < bytes.length; i++) { // byteArr[i] = bytes.charCodeAt(i); // } // console.log(byteArr); // this.axiosClient = axios.create(this.binaryHeader()); // const result = await this.axiosClient.post(`https://francecentral.api.cognitive.microsoft.com/face/v1.0/persongroups/${personGroupId}/persons/${personId}/persistedFaces`,); // console.log(result); return "result"; } async getGroup(){ this.axiosClient = axios.create(this.jsonHeader()); const result = await this.axiosClient.get("https://francecentral.api.cognitive.microsoft.com/face/v1.0/persongroups/1/persons?top=1000"); return result.data; } jsonHeader(){ return { headers: { 'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key' : KEY } }; } binaryHeader(){ return { headers: { 'Content-Type': 'multipart/form-data', 'Ocp-Apim-Subscription-Key' : KEY, } } } } module.exports.FaceApiService = FaceApiService; module.exports.service = new FaceApiService();
29.789474
183
0.57715
16d7091ecb25e94ef09f4bd9be0fc685efc6d176
645
ts
TypeScript
types/emojione/emojione-tests.ts
fes300/DefinitelyTyped
0ff89f656c5e796284e155524b64c53bb0ee4998
[ "MIT" ]
35,620
2015-11-04T04:20:38.000Z
2022-03-31T21:14:58.000Z
types/emojione/emojione-tests.ts
fes300/DefinitelyTyped
0ff89f656c5e796284e155524b64c53bb0ee4998
[ "MIT" ]
49,391
2015-11-04T05:15:18.000Z
2022-03-31T23:44:18.000Z
types/emojione/emojione-tests.ts
fes300/DefinitelyTyped
0ff89f656c5e796284e155524b64c53bb0ee4998
[ "MIT" ]
36,450
2015-11-04T04:30:18.000Z
2022-03-31T23:29:51.000Z
emojione.sprites = true; emojione.imagePathPNG = 'foobar'; emojione.imagePathSVG = 'foobar'; emojione.imagePathSVGSprites = 'foobar'; emojione.imageType = 'svg'; emojione.unicodeAlt = false; emojione.ascii = true; emojione.unicodeRegexp = '123.*'; emojione.cacheBustParam = 'asdf'; emojione.emojioneList = { ':hi:': { unicode: ['foobar'], fname: 'foobar', uc: 'foobar', isCanonical: false } }; const myShort: string = emojione.toShort('hi'); const myImage1: string = emojione.toImage('hi'); const myImage2: string = emojione.shortnameToImage('hi'); const myImage3: string = emojione.unicodeToImage('hi');
29.318182
57
0.686822
3bbea758c7784620aacd7636cf98a167fd38b0b4
2,353
c
C
heclib/heclib_c/src/Utilities/numberBytesInCharArray.c
HydrologicEngineeringCenter/heclib
dd3111ee2a8d0c80b88d21bd529991f154fec40a
[ "MIT" ]
19
2021-03-09T17:42:30.000Z
2022-03-21T21:46:47.000Z
heclib/heclib_c/src/Utilities/numberBytesInCharArray.c
HydrologicEngineeringCenter/heclib
dd3111ee2a8d0c80b88d21bd529991f154fec40a
[ "MIT" ]
22
2021-06-17T20:01:28.000Z
2022-03-21T21:33:29.000Z
heclib/heclib_c/src/Utilities/numberBytesInCharArray.c
HydrologicEngineeringCenter/heclib
dd3111ee2a8d0c80b88d21bd529991f154fec40a
[ "MIT" ]
3
2021-06-16T17:48:30.000Z
2022-01-13T16:44:47.000Z
#include <string.h> #include <stdio.h> #include <stdlib.h> #include "heclib7.h" int numberBytesInDoubleCharArray(const char **charArray, int numberRows, int numberColumns, int *expandedSize) { // Counts the number of bytes in numberStrings null terminated strings in charArray. // Any character less than 0 is considered filler and ignored. // If max is set (> 0), then limit that number of bytes int i; int j; int ipos; int numberBytes; int len; int *maxColumnSize; const char *cstring; numberBytes = 0; maxColumnSize = (int *)calloc((size_t)numberColumns, WORD_SIZE); for (i=0; i<numberRows; i++) { for (j=0; j<numberColumns; j++) { ipos = (i * numberColumns) + j; cstring = charArray[ipos]; len = (int)strlen(cstring) + 1; numberBytes += len; if (len > maxColumnSize[j]) { maxColumnSize[j] = len; } } } *expandedSize = 0; for (j=0; j<numberColumns; j++) { *expandedSize += maxColumnSize[j]; } *expandedSize *= numberRows; if (maxColumnSize) { free(maxColumnSize); } return numberBytes; } int compressCharArray(const char **charArrayIn, char *charArrayOut, int numberRows, int numberColumns, int max) { // Counts the number of bytes in numberStrings null terminated strings in charArray. // Any character less than 0 is considered filler and ignored. // If max is set (> 0), then limit that number of bytes int i; int j; int ipos; int numberBytes; int len; const char *cstring; numberBytes = 0; for (i=0; i<numberRows; i++) { for (j=0; j<numberColumns; j++) { ipos = (i * numberColumns) + j; cstring = charArrayIn[ipos]; len = (int)strlen(cstring) + 1; if ((numberBytes + len) > max) { } stringCopy(&charArrayOut[numberBytes], (max - numberBytes), cstring, len); numberBytes += len; } } return numberBytes; } int buildTablePointerArray(char *charArrayIn, char **tablePointerArrayOut, int numberRows, int numberColumns, int max) { int i; int j; int ipos; int numberBytes; int len; char *cstring; numberBytes = 0; for (i=0; i<numberRows; i++) { for (j=0; j<numberColumns; j++) { cstring = &charArrayIn[numberBytes]; ipos = (i * numberColumns) + j; tablePointerArrayOut[ipos] = cstring; len = (int)strlen(cstring) + 1; numberBytes += len; if (numberBytes > max) { // FIX ME } } } return numberBytes; }
22.409524
118
0.666383
5bf2d14ccc266c35bf976e67acacece3041afb78
143
h
C
usr/HwVeri/SNRLib/dsp-toolbox/dsptool.h
Bhaskers-Blu-Org2/Sora
6aa5411db71199e56d5cb24265b01a89f49b40f4
[ "BSD-2-Clause" ]
270
2015-07-17T15:43:43.000Z
2019-04-21T12:13:58.000Z
usr/HwVeri/SNRLib/dsp-toolbox/dsptool.h
JamesLinus/Sora
6aa5411db71199e56d5cb24265b01a89f49b40f4
[ "BSD-2-Clause" ]
null
null
null
usr/HwVeri/SNRLib/dsp-toolbox/dsptool.h
JamesLinus/Sora
6aa5411db71199e56d5cb24265b01a89f49b40f4
[ "BSD-2-Clause" ]
106
2015-07-20T10:40:34.000Z
2019-04-25T10:02:26.000Z
#pragma once #include "dspcomm.h" #include "templtrick.h" #include "slackq.h" #include "brick.h" #include "dsplib.h" //#include "simplewnd.h"
15.888889
24
0.706294
fc92ff33b2efab5d3de492e88e14b09c4dea4c59
98
css
CSS
src/components/_mobile/Measurement/Measurement.css
andy-haynes/zymancer_legacy
87e11b6c45542e0600d513a2b1010ba9dc1ce6ac
[ "MIT" ]
null
null
null
src/components/_mobile/Measurement/Measurement.css
andy-haynes/zymancer_legacy
87e11b6c45542e0600d513a2b1010ba9dc1ce6ac
[ "MIT" ]
null
null
null
src/components/_mobile/Measurement/Measurement.css
andy-haynes/zymancer_legacy
87e11b6c45542e0600d513a2b1010ba9dc1ce6ac
[ "MIT" ]
null
null
null
.measurement { } .measurementValue { position: relative; bottom: 4px; } .measurementUnit { }
9.8
21
0.683673
b7461a31a4c74904daa8d8c81e103c60b00a4177
1,005
lua
Lua
spec/web/mixins/authcookie_spec.lua
akornatskyy/lucid
c23d60921cf5037ea2d544ffb42eac3ba2c551b1
[ "MIT" ]
10
2018-03-26T14:52:41.000Z
2022-01-27T15:56:31.000Z
spec/web/mixins/authcookie_spec.lua
akornatskyy/lucid
c23d60921cf5037ea2d544ffb42eac3ba2c551b1
[ "MIT" ]
1
2021-04-28T22:11:54.000Z
2021-06-25T15:28:56.000Z
spec/web/mixins/authcookie_spec.lua
akornatskyy/lucid
c23d60921cf5037ea2d544ffb42eac3ba2c551b1
[ "MIT" ]
1
2018-05-03T04:16:51.000Z
2018-05-03T04:16:51.000Z
local authcookie = require 'web.mixins.authcookie' local request = require 'http.functional.request' local writer = require 'http.functional.response' local describe, it, assert = describe, it, assert describe('web.mixins.authcookie', function() it('extends time left', function() local c = setmetatable({ req = request.new { headers = { cookie = '_a=cookie' }, options = { auth_cookie = {name = '_a'}, ticket = { max_age = 15, decode = function(self, c) assert.equals('cookie', c) return '1', 5 end, encode = function(self, p) assert.equals('1', p) return '2' end } } }, w = writer.new() }, {__index=authcookie}) local p, time_left = c:parse_auth_cookie() assert.equals('1', p) assert.equals(5, time_left) assert.equals('_a=2; HttpOnly', c.w.headers['Set-Cookie']) end) end)
27.916667
66
0.541294
b2b541552dee04f9e9bcd11e4c109a74ce0c81b7
1,697
py
Python
timesketch/lib/cypher/insertable_string.py
Marwolf/timesketch
8fbbb3d0a5a50dc0214fc56a9bbec82050908103
[ "Apache-2.0" ]
null
null
null
timesketch/lib/cypher/insertable_string.py
Marwolf/timesketch
8fbbb3d0a5a50dc0214fc56a9bbec82050908103
[ "Apache-2.0" ]
null
null
null
timesketch/lib/cypher/insertable_string.py
Marwolf/timesketch
8fbbb3d0a5a50dc0214fc56a9bbec82050908103
[ "Apache-2.0" ]
null
null
null
# Copyright 2017 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Module containing the InsertableString class.""" class InsertableString(object): """Class that accumulates insert and replace operations for a string and later performs them all at once so that positions in the original string can be used in all of the operations. """ def __init__(self, input_string): self.input_string = input_string self.to_insert = [] def insert_at(self, pos, s): """Add an insert operation at given position.""" self.to_insert.append((pos, pos, s)) def replace_range(self, start, end, s): """Add a replace operation for given range. Assume that all replace_range operations are disjoint, otherwise undefined behavior. """ self.to_insert.append((start, end, s)) def apply_insertions(self): """Return a string obtained by performing all accumulated operations.""" to_insert = reversed(sorted(self.to_insert)) result = self.input_string for start, end, s in to_insert: result = result[:start] + s + result[end:] return result
39.465116
80
0.696523
9c6865792d515e378b8ad181b0bbf6aba39ddc16
2,231
js
JavaScript
app_api/controllers/userController.js
Noah-Huff/my-work-spot
a3d80388fbce731f52ef74708ab9b018eb05b0ce
[ "MIT" ]
null
null
null
app_api/controllers/userController.js
Noah-Huff/my-work-spot
a3d80388fbce731f52ef74708ab9b018eb05b0ce
[ "MIT" ]
null
null
null
app_api/controllers/userController.js
Noah-Huff/my-work-spot
a3d80388fbce731f52ef74708ab9b018eb05b0ce
[ "MIT" ]
1
2021-04-23T03:29:51.000Z
2021-04-23T03:29:51.000Z
const passport = require('passport'); const asyncHandler = require('express-async-handler'); const mongoose = require('mongoose'); const Loc = mongoose.model('Location'); const Admin = mongoose.model('Admin'); /* const _getAdmin = (req, res, callback) => { if ( req.payload && req.payload.email ) { Admin.findOne({ email: req.payload.email }) .exec( ( err, admin ) => { if ( !admin ) { return res.status(404).json( { "message" : "Not an admin user" } ); } else if ( err ) { console.log(err); return res.status(404).json(err); } }); } else { return res.status(404).json( { "message" : "User not found " } ); } } */ const createAdmin = (req, res) => { if (!req.body.name || !req.body.email || !req.body.password) { return res .status(400) .json({"message": "All fields required!"}); } const admin = new Admin(); admin.name = req.body.name; admin.email = req.body.email; admin.setPassword(req.body.password); admin.save((err, admin) => { if (err) { res .status(404) .json(err); } else { const token = admin.generateJwt(); res .status(200) .json({token}); } }); }; const authUser = asyncHandler(async (req, res) => { console.log("AUTHUSER"); if (req.body.email.length <= 1 || req.body.password == '' || req.body.name == '') { return res .status(400) .json({"message": "All fields required."}); } passport.authenticate('local', (err, admin, info) => { let token; if (err) { return res .status(404) .json(err); } if (admin) { token = admin.generateJwt(); res .status(200) .json({token}); } else { res .status(401) .json(info); } })(req, res); }); const adminLogin = { }; const adminViewLocations = { }; const adminDeleteLocation = { }; const adminAddLocation = { }; module.exports = { createAdmin, authUser };
22.535354
87
0.494845
91fc70a646ebab4aeddadd554caf6b5efa111ac9
8,532
rs
Rust
src/lib.rs
dotcypress/st7032i
2eaf63af371652660b98c12bfb1702b303ef9cf7
[ "Apache-2.0", "MIT" ]
1
2020-02-11T22:09:55.000Z
2020-02-11T22:09:55.000Z
src/lib.rs
dotcypress/st7032i
2eaf63af371652660b98c12bfb1702b303ef9cf7
[ "Apache-2.0", "MIT" ]
null
null
null
src/lib.rs
dotcypress/st7032i
2eaf63af371652660b98c12bfb1702b303ef9cf7
[ "Apache-2.0", "MIT" ]
null
null
null
//! A platform agnostic Rust driver for the ST7032i, based on the //! [`embedded-hal`](https://github.com/japaric/embedded-hal) traits. //! //! ## The Device //! //! The Sitronix ST7032i is a dot matrix LCD controller with I²C interface. //! //! - [Details and datasheet](http://www.newhavendisplay.com/app_notes/ST7032.pdf) //! //! ## Usage //! //! ### Instantiating //! //! Import this crate and an `embedded_hal` implementation: //! //! ``` //! extern crate linux_embedded_hal as hal; //! extern crate st7032i; //! ``` //! //! Then instantiate the device: //! //! ```no_run //! use core::fmt::Write; //! use linux_embedded_hal::{Delay, I2cdev}; //! use st7032i::ST7032i; //! //! # fn main() { //! let dev = I2cdev::new("/dev/i2c-1")?; //! let mut display = ST7032i::new(dev, Delay, 2); //! display.init()?; //! write!(display, "Hello")?; //! display.move_cursor(1, 0)?; //! write!(display, "Rust")?; //! # } //! ``` #![no_std] extern crate embedded_hal as hal; use core::fmt; use hal::blocking::delay::DelayMs; use hal::blocking::i2c::{Read, Write, WriteRead}; pub const I2C_ADRESS: u8 = 0x3e; /// ST7032i instruction set #[derive(Debug, PartialEq)] enum InstructionSet { Normal, Extented, } /// Moving direction #[derive(Debug, PartialEq, Clone, Copy)] pub enum Direction { LeftToRigh, RightToLeft, } /// Driver for the ST7032i #[derive(Debug)] pub struct ST7032i<I2C, D> { i2c: I2C, delay: D, entry: Direction, lines: u8, scroll: bool, display: bool, cursor: bool, blink: bool, } impl<I2C, E, D> ST7032i<I2C, D> where I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>, D: DelayMs<u8>, { /// Initialize the ST7032i driver. pub fn new(i2c: I2C, delay: D, lines: u8) -> Self { ST7032i { i2c, delay, lines, entry: Direction::RightToLeft, scroll: false, display: false, cursor: false, blink: false, } } /// Initialize the display. pub fn init(&mut self) -> Result<(), E> { match self.send_function(InstructionSet::Normal, 1, false) { Ok(_) => self.delay.delay_ms(1), Err(_) => self.delay.delay_ms(20), }; self.send_function(InstructionSet::Extented, 1, false)?; self.delay.delay_ms(5); self.send_function(InstructionSet::Extented, 1, false)?; self.delay.delay_ms(5); self.send_function(InstructionSet::Extented, self.lines, false)?; self.delay.delay_ms(5); self.off()?; self.send_osc_config(true, 0)?; self.send_contrast(0)?; self.send_booster_config(true, false, 0)?; self.send_follower_config(true, 0)?; self.send_entry_mode()?; self.delay.delay_ms(20); self.on()?; self.clear() } /// Switch display on pub fn on(&mut self) -> Result<(), E> { self.display = true; self.send_display_mode() } /// Switch display off pub fn off(&mut self) -> Result<(), E> { self.display = false; self.send_display_mode() } /// Clear all the display data by writing "20H" (space code) /// to all DDRAM address, and set DDRAM address to "00H" into AC (address counter). pub fn clear(&mut self) -> Result<(), E> { const CLEAR_DISPLAY: u8 = 0b_00000001; self.send_command(CLEAR_DISPLAY)?; self.delay.delay_ms(2); Ok(()) } /// Set DDRAM address to "0" and return cursor to its original position if shifted. /// The contents of DDRAM are not changed. pub fn home(&mut self) -> Result<(), E> { const RETURN_HOME: u8 = 0b_00000010; self.send_command(RETURN_HOME)?; self.delay.delay_ms(2); Ok(()) } /// Move cursor to specified location pub fn move_cursor(&mut self, row: u8, col: u8) -> Result<(), E> { let command = match row { 0 => col | 0b_10000000, _ => col | 0b_11000000, }; self.send_command(command) } /// Show cursor pub fn show_cursor(&mut self, blink: bool) -> Result<(), E> { self.cursor = true; self.blink = blink; self.send_display_mode() } /// Hide cursor pub fn hide_cursor(&mut self) -> Result<(), E> { self.cursor = false; self.blink = false; self.send_display_mode() } /// Enable autoscroll pub fn enable_scroll(&mut self, entry: Direction) -> Result<(), E> { self.scroll = true; self.entry = entry; self.send_entry_mode() } /// Disable autoscroll pub fn disable_scroll(&mut self) -> Result<(), E> { self.scroll = false; self.send_entry_mode() } /// Shift display to specified direction pub fn shift_display(&mut self, dir: Direction) -> Result<(), E> { let mut command = 0b_00011000; if dir == Direction::LeftToRigh { command |= 0b_00000100; } self.send_command(command) } /// Shift cursor to specified direction pub fn shift_cursor(&mut self, dir: Direction) -> Result<(), E> { let mut command = 0b_00010000; if dir == Direction::LeftToRigh { command |= 0b_00000100; } self.send_command(command) } /// Create custom character in CGRAM pub fn create_char(&mut self, offset: u8, bitmap: [u8; 8]) -> Result<(), E> { self.send_command(0x40 | ((offset & 0x7) << 3))?; let mut command = [0x40, 0]; for byte in bitmap.iter() { command[1] = *byte; self.i2c.write(I2C_ADRESS, &command).ok(); } self.delay.delay_ms(1); Ok(()) } fn send_entry_mode(&mut self) -> Result<(), E> { let mut command = 0b_00000100; if self.scroll { command |= 0b_00000001; } if self.entry == Direction::LeftToRigh { command |= 0b_00000010; } self.send_command(command) } fn send_display_mode(&mut self) -> Result<(), E> { let mut command = 0b_00001000; if self.blink { command |= 0b_00000001; } if self.cursor { command |= 0b_00000010; } if self.display { command |= 0b_00000100; } self.send_command(command) } fn send_function(&mut self, is: InstructionSet, lines: u8, dbl: bool) -> Result<(), E> { let mut command = 0b_00110000; if lines > 1 { command |= 0b_00001000; } else if dbl { command |= 0b_00000100; } if is == InstructionSet::Extented { command |= 0b_00000001; } self.send_command(command) } fn send_osc_config(&mut self, bias: bool, freq: u8) -> Result<(), E> { assert!(freq < 8); let mut command = 0b_00010000 | freq; if bias { command |= 0b_00001000; } self.send_command(command) } fn send_contrast(&mut self, contrast: u8) -> Result<(), E> { assert!(contrast < 16); self.send_command(0b_01110000 | contrast) } fn send_booster_config(&mut self, on: bool, icon: bool, contrast_low: u8) -> Result<(), E> { assert!(contrast_low < 4); let mut command = 0b_01010000 | contrast_low; if on { command |= 0b_00000100; } if icon { command |= 0b_00001000; } self.send_command(command) } fn send_follower_config(&mut self, on: bool, ratio: u8) -> Result<(), E> { assert!(ratio < 8); let mut command = 0b_01100000 | ratio; if on { command |= 0b_00001000; } self.send_command(command) } fn send_command(&mut self, command: u8) -> Result<(), E> { self.i2c.write(I2C_ADRESS, &[0x80, command])?; self.delay.delay_ms(1); Ok(()) } } impl<I2C, E, D> fmt::Write for ST7032i<I2C, D> where I2C: Read<Error = E> + Write<Error = E> + WriteRead<Error = E>, D: DelayMs<u8>, { fn write_str(&mut self, s: &str) -> fmt::Result { for c in s.chars() { self.write_char(c)?; } self.delay.delay_ms(1); Ok(()) } fn write_char(&mut self, c: char) -> fmt::Result { let mut command = [0x40, 0, 0, 0]; c.encode_utf8(&mut command[1..]); self.i2c.write(I2C_ADRESS, &command[..2]).ok(); Ok(()) } }
26.414861
96
0.553329
70ccf0f200bdee30e0015ae6b23273b69e2e4400
3,750
go
Go
components/application-registry/internal/metadata/specification/download/client.go
FWinkler79/kyma
4ef0055807666cd54c5cbbeecd3aa17918d5d982
[ "Apache-2.0" ]
1,351
2018-07-04T06:14:20.000Z
2022-03-31T16:28:47.000Z
components/application-registry/internal/metadata/specification/download/client.go
FWinkler79/kyma
4ef0055807666cd54c5cbbeecd3aa17918d5d982
[ "Apache-2.0" ]
11,211
2018-07-24T22:47:33.000Z
2022-03-31T19:29:15.000Z
components/application-registry/internal/metadata/specification/download/client.go
FWinkler79/kyma
4ef0055807666cd54c5cbbeecd3aa17918d5d982
[ "Apache-2.0" ]
481
2018-07-24T14:13:41.000Z
2022-03-31T15:55:46.000Z
package download import ( "io/ioutil" "net/http" "net/url" "github.com/kyma-project/kyma/components/application-gateway/pkg/authorization" "github.com/kyma-project/kyma/components/application-gateway/pkg/httpconsts" "github.com/kyma-project/kyma/components/application-registry/internal/apperrors" "github.com/kyma-project/kyma/components/application-registry/internal/metadata/model" ) const timeout = 5 type Client interface { Fetch(url string, credentials *authorization.Credentials, parameters *model.RequestParameters) ([]byte, apperrors.AppError) } type downloader struct { client *http.Client authorizationFactory authorization.StrategyFactory } func NewClient(client *http.Client, authFactory authorization.StrategyFactory) Client { return downloader{ client: client, authorizationFactory: authFactory, } } func (d downloader) Fetch(url string, credentials *authorization.Credentials, parameters *model.RequestParameters) ([]byte, apperrors.AppError) { res, err := d.requestAPISpec(url, credentials, parameters) if err != nil { return nil, err } { bytes, err := ioutil.ReadAll(res.Body) if err != nil { return nil, apperrors.Internal("Failed to read response body from %s.", url) } return bytes, nil } } func (d downloader) requestAPISpec(specUrl string, credentials *authorization.Credentials, parameters *model.RequestParameters) (*http.Response, apperrors.AppError) { req, err := http.NewRequest(http.MethodGet, specUrl, nil) if err != nil { return nil, apperrors.Internal("Creating request for fetching API spec from %s failed, %s", specUrl, err.Error()) } if credentials != nil { err := d.addAuthorization(req, credentials) if err != nil { return nil, apperrors.UpstreamServerCallFailed("Adding authorization for fetching API spec from %s failed, %s", specUrl, err.Error()) } } if parameters != nil { setCustomQueryParameters(req.URL, parameters.QueryParameters) setCustomHeaders(req.Header, parameters.Headers) } response, err := d.client.Do(req) if err != nil { return nil, apperrors.UpstreamServerCallFailed("Fetching API spec from %s failed, %s", specUrl, err.Error()) } if response.StatusCode != http.StatusOK { return nil, apperrors.UpstreamServerCallFailed("Fetching API spec from %s failed with status %s", specUrl, response.Status) } return response, nil } func (d downloader) addAuthorization(r *http.Request, credentials *authorization.Credentials) apperrors.AppError { ts := func(transport *http.Transport) { d.client.Transport = transport } strategy := d.authorizationFactory.Create(credentials) err := strategy.AddAuthorization(r, ts) if err != nil { return apperrors.Internal(err.Error()) } return nil } func setCustomQueryParameters(url *url.URL, queryParams *map[string][]string) { if queryParams == nil { return } reqQueryValues := url.Query() for customQueryParam, values := range *queryParams { if _, ok := reqQueryValues[customQueryParam]; ok { continue } reqQueryValues[customQueryParam] = values } url.RawQuery = reqQueryValues.Encode() } func setCustomHeaders(reqHeaders http.Header, customHeaders *map[string][]string) { if _, ok := reqHeaders[httpconsts.HeaderUserAgent]; !ok { // explicitly disable User-Agent so it's not set to default value reqHeaders.Set(httpconsts.HeaderUserAgent, "") } setHeaders(reqHeaders, customHeaders) } func setHeaders(reqHeaders http.Header, customHeaders *map[string][]string) { if customHeaders == nil { return } for header, values := range *customHeaders { if _, ok := reqHeaders[header]; ok { // if header is already specified we do not interfere with it continue } reqHeaders[header] = values } }
27.573529
166
0.735733
9a17f74988dbc4d9b8f7623b947bff8b55881361
18,848
css
CSS
widgets/common/assets/gradients/glassy/glassyAzure/glassyAzure1.css
idutta2007/yiigems
4278e750db1f19d50615a5acc7a93c8802ff5618
[ "MIT" ]
1
2015-11-02T14:12:02.000Z
2015-11-02T14:12:02.000Z
widgets/common/assets/gradients/glassy/glassyAzure/glassyAzure1.css
idutta2007/yiigems
4278e750db1f19d50615a5acc7a93c8802ff5618
[ "MIT" ]
1
2015-11-01T08:58:53.000Z
2016-01-02T09:25:49.000Z
widgets/common/assets/gradients/glassy/glassyAzure/glassyAzure1.css
idutta2007/yiigems
4278e750db1f19d50615a5acc7a93c8802ff5618
[ "MIT" ]
null
null
null
.background_glassyAzure1, .hover_background_glassyAzure1:hover, .active_background_glassyAzure1:active:hover { background: #f0ffff; background-image: -moz-linear-gradient(top, rgb(190, 255, 255) 0%, rgb(141, 255, 255) 50%, rgb(92, 255, 255) 55%, rgb(240, 255, 255) 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(190, 255, 255)), color-stop(50%, rgb(141, 255, 255)), color-stop(55%, rgb(92, 255, 255)), color-stop(100%, rgb(240, 255, 255))); background-image: -webkit-linear-gradient(top, rgb(190, 255, 255) 0%, rgb(141, 255, 255) 50%, rgb(92, 255, 255) 55%, rgb(240, 255, 255) 100%); background-image: -o-linear-gradient(top, rgb(190, 255, 255) 0%, rgb(141, 255, 255) 50%, rgb(92, 255, 255) 55%, rgb(240, 255, 255) 100%); background-image: -ms-linear-gradient(top, rgb(190, 255, 255) 0%, rgb(141, 255, 255) 50%, rgb(92, 255, 255) 55%, rgb(240, 255, 255) 100%); background-image: linear-gradient(to bottom, rgb(190, 255, 255) 0%, rgb(141, 255, 255) 50%, rgb(92, 255, 255) 55%, rgb(240, 255, 255) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#beffff', endColorstr='#f0ffff',GradientType=0 ); } .background_glassyAzure1h, .hover_background_glassyAzure1h:hover, .active_background_glassyAzure1h:active:hover { background: #f0ffff; background-image: -moz-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(220, 255, 255) 50%, rgb(161, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(255, 255, 255)), color-stop(50%, rgb(220, 255, 255)), color-stop(55%, rgb(161, 255, 255)), color-stop(100%, rgb(255, 255, 255))); background-image: -webkit-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(220, 255, 255) 50%, rgb(161, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -o-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(220, 255, 255) 50%, rgb(161, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -ms-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(220, 255, 255) 50%, rgb(161, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: linear-gradient(to bottom, rgb(255, 255, 255) 0%, rgb(220, 255, 255) 50%, rgb(161, 255, 255) 55%, rgb(255, 255, 255) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); } .background_glassyAzure1a, .hover_background_glassyAzure1a:hover, .active_background_glassyAzure1a:active:hover { background: #f0ffff; background-image: -moz-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(161, 255, 255) 50%, rgb(220, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(255, 255, 255)), color-stop(50%, rgb(161, 255, 255)), color-stop(55%, rgb(220, 255, 255)), color-stop(100%, rgb(255, 255, 255))); background-image: -webkit-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(161, 255, 255) 50%, rgb(220, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -o-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(161, 255, 255) 50%, rgb(220, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -ms-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(161, 255, 255) 50%, rgb(220, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: linear-gradient(to bottom, rgb(255, 255, 255) 0%, rgb(161, 255, 255) 50%, rgb(220, 255, 255) 55%, rgb(255, 255, 255) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); } .background_glassyAzure1s, .hover_background_glassyAzure1s:hover, .active_background_glassyAzure1s:active:hover { background: #f0ffff; background-image: -moz-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 50%, rgb(255, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgb(255, 255, 255)), color-stop(50%, rgb(255, 255, 255)), color-stop(55%, rgb(255, 255, 255)), color-stop(100%, rgb(255, 255, 255))); background-image: -webkit-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 50%, rgb(255, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -o-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 50%, rgb(255, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: -ms-linear-gradient(top, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 50%, rgb(255, 255, 255) 55%, rgb(255, 255, 255) 100%); background-image: linear-gradient(to bottom, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 50%, rgb(255, 255, 255) 55%, rgb(255, 255, 255) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); } .background_color_glassyAzure1, .hover_background_color_glassyAzure1:hover, .active_background_color_glassyAzure1:active:hover { background-color:#f0ffff; } .background_first_color_glassyAzure1, .hover_background_first_color_glassyAzure1:hover, .active_background_first_color_glassyAzure1:active:hover { background-color:#beffff; } .background_last_color_glassyAzure1, .hover_background_last_color_glassyAzure1:hover, .active_background_color_last_glassyAzure1:active:hover { background-color:#f0ffff; } /* ------------------------------ color settings -------------------------------*/ .color_glassyAzure1, .hover_color_glassyAzure1:hover, .active_color_glassyAzure1:active:hover { color: #282828; } .color_glassyAzure1h, .hover_color_glassyAzure1h:hover, .active_color_glassyAzure1h:active:hover { color: #282828; } .color_glassyAzure1a, .hover_color_glassyAzure1a:hover, .active_color_glassyAzure1a:active:hover { color: #ff0; } .color_glassyAzure1s, .hover_color_glassyAzure1s:hover, .active_color_glassyAzure1s:active:hover { color: #dd0; } /* -------------------------- border color settings -----------------------------*/ .border_glassyAzure1, .hover_border_glassyAzure1:hover, .active_border_glassyAzure1:active:hover { border-color: #65ffff #2affff #2affff #65ffff; } .border_glassyAzure1h, .hover_border_glassyAzure1h:hover, .active_border_glassyAzure1h:active:hover { border-color: #65ffff #2affff #2affff #65ffff; } .border_glassyAzure1a, .hover_border_glassyAzure1a:hover, .active_border_glassyAzure1a:active:hover { border-color: #16ffff #16ffff #16ffff #16ffff; } .border_glassyAzure1s, .hover_border_glassyAzure1s:hover, .active_border_glassyAzure1s:active:hover { border-color: #16ffff #16ffff #16ffff #16ffff; } /* -------------------------- shadow expand settings --------------------------------*/ .shadow_expand_glassyAzure1, .hover_shadow_expand_glassyAzure1:hover, .active_shadow_expand_glassyAzure1:active:hover { -webkit-box-shadow: 0em 0em 1em 0.25em rgba(240, 255, 255, .39); -moz-box-shadow: 0em 0em 1em 0.25em rgba(240, 255, 255, .39); box-shadow: 0em 0em 1em 0.25em rgba(240, 255, 255, .39); } .shadow_expand_glassyAzure1h, .hover_shadow_expand_glassyAzure1h:hover, .active_shadow_expand_glassyAzure1h:active:hover { -webkit-box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .50); -moz-box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .50); box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .50); } .shadow_expand_glassyAzure1a, .hover_shadow_expand_glassyAzure1a:hover, .active_shadow_expand_glassyAzure1a:active:hover { -webkit-box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .63); -moz-box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .63); box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .63); } .shadow_expand_glassyAzure1s, .hover_shadow_expand_glassyAzure1s:hover, .active_shadow_expand_glassyAzure1s:active:hover { -webkit-box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .78); -moz-box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .78); box-shadow: 0em 0em 1em 0.25em rgba(255, 255, 255, .78); } /* -------------------------- shadow left settings --------------------------------*/ .shadow_left_glassyAzure1, .hover_shadow_left_glassyAzure1:hover, .active_shadow_left_glassyAzure1:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(240, 255, 255, .39); -moz-box-shadow: -0.5em -0.5em 1em rgba(240, 255, 255, .39); box-shadow: -0.5em -0.5em 1em rgba(240, 255, 255, .39); } .shadow_left_glassyAzure1h, .hover_shadow_left_glassyAzure1h:hover, .active_shadow_left_glassyAzure1h:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .50); -moz-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .50); box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .50); } .shadow_left_glassyAzure1a, .hover_shadow_left_glassyAzure1a:hover, .active_shadow_left_glassyAzure1a:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .63); -moz-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .63); box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .63); } .shadow_left_glassyAzure1s, .hover_shadow_left_glassyAzure1s:hover, .active_shadow_left_glassyAzure1s:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .78); -moz-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .78); box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .78); } /* -------------------------- shadow right settings --------------------------------*/ .shadow_right_glassyAzure1, .hover_shadow_right_glassyAzure1:hover, .active_shadow_right_glassyAzure1:active:hover { -webkit-box-shadow: 0.5em 0em 1em rgba(240, 255, 255, .39); -moz-box-shadow: 0.5em 0em 1em rgba(240, 255, 255, .39); box-shadow: 0.5em 0em 1em rgba(240, 255, 255, .39); } .shadow_right_glassyAzure1h, .hover_shadow_right_glassyAzure1h:hover, .active_shadow_right_glassyAzure1h:active:hover { -webkit-box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .50); -moz-box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .50); box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .50); } .shadow_right_glassyAzure1a, .hover_shadow_right_glassyAzure1a:hover, .active_shadow_right_glassyAzure1a:active:hover { -webkit-box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .63); -moz-box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .63); box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .63); } .shadow_right_glassyAzure1s, .hover_shadow_right_glassyAzure1s:hover, .active_shadow_right_glassyAzure1s:active:hover { -webkit-box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .78); -moz-box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .78); box-shadow: 0.5em 0em 1em rgba(255, 255, 255, .78); } /* -------------------------- shadow top settings --------------------------------*/ .shadow_top_glassyAzure1, .hover_shadow_top_glassyAzure1:hover, .active_shadow_top_glassyAzure1:active:hover { -webkit-box-shadow: 0em -0.5em 1em rgba(240, 255, 255, .39); -moz-box-shadow: 0em -0.5em 1em rgba(240, 255, 255, .39); box-shadow: 0em -0.5em 1em rgba(240, 255, 255, .39); } .shadow_top_glassyAzure1h, .hover_shadow_top_glassyAzure1h:hover, .active_shadow_top_glassyAzure1h:active:hover { -webkit-box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .50); -moz-box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .50); box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .50); } .shadow_top_glassyAzure1a, .hover_shadow_top_glassyAzure1a:hover, .active_shadow_top_glassyAzure1a:active:hover { -webkit-box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .63); -moz-box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .63); box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .63); } .shadow_top_glassyAzure1s, .hover_shadow_top_glassyAzure1s:hover, .active_shadow_top_glassyAzure1s:active:hover { -webkit-box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .78); -moz-box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .78); box-shadow: 0em -0.5em 1em rgba(255, 255, 255, .78); } /* -------------------------- shadow bottom settings --------------------------------*/ .shadow_bottom_glassyAzure1, .hover_shadow_bottom_glassyAzure1:hover, .active_shadow_bottom_glassyAzure1:active:hover { -webkit-box-shadow: 0em 0.5em 1em rgba(240, 255, 255, .39); -moz-box-shadow: 0em 0.5em 1em rgba(240, 255, 255, .39); box-shadow: 0em 0.5em 1em rgba(240, 255, 255, .39); } .shadow_bottom_glassyAzure1h, .hover_shadow_bottom_glassyAzure1h:hover, .active_shadow_bottom_glassyAzure1h:active:hover { -webkit-box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .50); -moz-box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .50); box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .50); } .shadow_bottom_glassyAzure1a, .hover_shadow_bottom_glassyAzure1a:hover, .active_shadow_bottom_glassyAzure1a:active:hover { -webkit-box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .63); -moz-box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .63); box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .63); } .shadow_bottom_glassyAzure1s, .hover_shadow_bottom_glassyAzure1s:hover, .active_shadow_bottom_glassyAzure1s:active:hover { -webkit-box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .78); -moz-box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .78); box-shadow: 0em 0.5em 1em rgba(255, 255, 255, .78); } /* -------------------------- shadow top_left settings --------------------------------*/ .shadow_top_left_glassyAzure1, .hover_shadow_top_left_glassyAzure1:hover, .active_shadow_top_left_glassyAzure1:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(240, 255, 255, .39); -moz-box-shadow: -0.5em -0.5em 1em rgba(240, 255, 255, .39); box-shadow: -0.5em -0.5em 1em rgba(240, 255, 255, .39); } .shadow_top_left_glassyAzure1h, .hover_shadow_top_left_glassyAzure1h:hover, .active_shadow_top_left_glassyAzure1h:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .50); -moz-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .50); box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .50); } .shadow_top_left_glassyAzure1a, .hover_shadow_top_left_glassyAzure1a:hover, .active_shadow_top_left_glassyAzure1a:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .63); -moz-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .63); box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .63); } .shadow_top_left_glassyAzure1s, .hover_shadow_top_left_glassyAzure1s:hover, .active_shadow_top_left_glassyAzure1s:active:hover { -webkit-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .78); -moz-box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .78); box-shadow: -0.5em -0.5em 1em rgba(255, 255, 255, .78); } /* -------------------------- shadow top_right settings --------------------------------*/ .shadow_top_right_glassyAzure1, .hover_shadow_top_right_glassyAzure1:hover, .active_shadow_top_right_glassyAzure1:active:hover { -webkit-box-shadow: 0.5em -0.5em 1em rgba(240, 255, 255, .39); -moz-box-shadow: 0.5em -0.5em 1em rgba(240, 255, 255, .39); box-shadow: 0.5em -0.5em 1em rgba(240, 255, 255, .39); } .shadow_top_right_glassyAzure1h, .hover_shadow_top_right_glassyAzure1h:hover, .active_shadow_top_right_glassyAzure1h:active:hover { -webkit-box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .50); -moz-box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .50); box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .50); } .shadow_top_right_glassyAzure1a, .hover_shadow_top_right_glassyAzure1a:hover, .active_shadow_top_right_glassyAzure1a:active:hover { -webkit-box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .63); -moz-box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .63); box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .63); } .shadow_top_right_glassyAzure1s, .hover_shadow_top_right_glassyAzure1s:hover, .active_shadow_top_right_glassyAzure1s:active:hover { -webkit-box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .78); -moz-box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .78); box-shadow: 0.5em -0.5em 1em rgba(255, 255, 255, .78); } /* -------------------------- shadow bottom_left settings --------------------------------*/ .shadow_bottom_left_glassyAzure1, .hover_shadow_bottom_left_glassyAzure1:hover, .active_shadow_bottom_left_glassyAzure1:active:hover { -webkit-box-shadow: -0.5em 0.5em 1em rgba(240, 255, 255, .39); -moz-box-shadow: -0.5em 0.5em 1em rgba(240, 255, 255, .39); box-shadow: -0.5em 0.5em 1em rgba(240, 255, 255, .39); } .shadow_bottom_left_glassyAzure1h, .hover_shadow_bottom_left_glassyAzure1h:hover, .active_shadow_bottom_left_glassyAzure1h:active:hover { -webkit-box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .50); -moz-box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .50); box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .50); } .shadow_bottom_left_glassyAzure1a, .hover_shadow_bottom_left_glassyAzure1a:hover, .active_shadow_bottom_left_glassyAzure1a:active:hover { -webkit-box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .63); -moz-box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .63); box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .63); } .shadow_bottom_left_glassyAzure1s, .hover_shadow_bottom_left_glassyAzure1s:hover, .active_shadow_bottom_left_glassyAzure1s:active:hover { -webkit-box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .78); -moz-box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .78); box-shadow: -0.5em 0.5em 1em rgba(255, 255, 255, .78); } /* -------------------------- shadow bottom_right settings --------------------------------*/ .shadow_bottom_right_glassyAzure1, .hover_shadow_bottom_right_glassyAzure1:hover, .active_shadow_bottom_right_glassyAzure1:active:hover { -webkit-box-shadow: 0.5em 0.5em 1em rgba(240, 255, 255, .39); -moz-box-shadow: 0.5em 0.5em 1em rgba(240, 255, 255, .39); box-shadow: 0.5em 0.5em 1em rgba(240, 255, 255, .39); } .shadow_bottom_right_glassyAzure1h, .hover_shadow_bottom_right_glassyAzure1h:hover, .active_shadow_bottom_right_glassyAzure1h:active:hover { -webkit-box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .50); -moz-box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .50); box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .50); } .shadow_bottom_right_glassyAzure1a, .hover_shadow_bottom_right_glassyAzure1a:hover, .active_shadow_bottom_right_glassyAzure1a:active:hover { -webkit-box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .63); -moz-box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .63); box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .63); } .shadow_bottom_right_glassyAzure1s, .hover_shadow_bottom_right_glassyAzure1s:hover, .active_shadow_bottom_right_glassyAzure1s:active:hover { -webkit-box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .78); -moz-box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .78); box-shadow: 0.5em 0.5em 1em rgba(255, 255, 255, .78); }
45.199041
218
0.686227
58ba66f88a53df254cc59509280ad86a702539c3
83
rs
Rust
heim-process/src/sys/macos/bindings/mod.rs
sMitea/heim
6aa21b847cf35dad9622476ad0f70ceaff1ea920
[ "Apache-2.0", "MIT" ]
753
2019-05-07T19:42:19.000Z
2022-03-19T07:27:26.000Z
heim-process/src/sys/macos/bindings/mod.rs
sMitea/heim
6aa21b847cf35dad9622476ad0f70ceaff1ea920
[ "Apache-2.0", "MIT" ]
336
2019-04-11T13:40:19.000Z
2022-01-24T02:57:14.000Z
heim-process/src/sys/macos/bindings/mod.rs
sMitea/heim
6aa21b847cf35dad9622476ad0f70ceaff1ea920
[ "Apache-2.0", "MIT" ]
88
2019-07-23T06:33:10.000Z
2022-03-30T07:03:41.000Z
mod proc_args; mod process; pub use self::proc_args::*; pub use self::process::*;
13.833333
27
0.698795
73be7168345e78c11f351312af0df288d33e255d
1,221
swift
Swift
QuakeX/QuakeX/Extensions/UIView+Ext.swift
FurkanHanciSecond/QuakeX
c3ae1ddef128e5d50f5c80e0f595bc8987108436
[ "MIT" ]
null
null
null
QuakeX/QuakeX/Extensions/UIView+Ext.swift
FurkanHanciSecond/QuakeX
c3ae1ddef128e5d50f5c80e0f595bc8987108436
[ "MIT" ]
null
null
null
QuakeX/QuakeX/Extensions/UIView+Ext.swift
FurkanHanciSecond/QuakeX
c3ae1ddef128e5d50f5c80e0f595bc8987108436
[ "MIT" ]
null
null
null
// // UIView+Ext.swift // QuakeX // // Created by Furkan Hanci on 2/16/22. // import UIKit extension UIView { func addSubviews(_ views: UIView...) { for view in views { addSubview(view) } } func pinToEdges(of superview: UIView) { translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ topAnchor.constraint(equalTo: superview.topAnchor), leadingAnchor.constraint(equalTo: superview.leadingAnchor), trailingAnchor.constraint(equalTo: superview.trailingAnchor), bottomAnchor.constraint(equalTo: superview.bottomAnchor) ]) } func dropShadow() { layer.shadowColor = Constants.Style.Color.cellShadow.cgColor layer.shadowOffset = CGSize(width: 0, height: 3) layer.shadowOpacity = 0.1 layer.shadowRadius = 2 } func dropDetailShadow() { layer.shadowColor = Constants.Style.Color.detailShadow.cgColor layer.shadowOffset = CGSize(width: 0, height: 3) layer.shadowOpacity = 0.1 layer.shadowRadius = 2 } func addBorder() { layer.borderWidth = 0.3 layer.borderColor = Constants.Style.Color.lightGray.cgColor } }
25.4375
70
0.65602
57ad1e2efbbc89d249a71e0f0a2c367ae6712f4f
1,031
kt
Kotlin
tools/acornui-build-tasks/src/jvmMain/kotlin/com/acornui/build/BasicMessageCollector.kt
fuzzyweapon/Acorn
a57100f894721ee342d23fe8cacb3fcbcedbe6dc
[ "Apache-2.0" ]
null
null
null
tools/acornui-build-tasks/src/jvmMain/kotlin/com/acornui/build/BasicMessageCollector.kt
fuzzyweapon/Acorn
a57100f894721ee342d23fe8cacb3fcbcedbe6dc
[ "Apache-2.0" ]
null
null
null
tools/acornui-build-tasks/src/jvmMain/kotlin/com/acornui/build/BasicMessageCollector.kt
fuzzyweapon/Acorn
a57100f894721ee342d23fe8cacb3fcbcedbe6dc
[ "Apache-2.0" ]
1
2019-06-07T16:36:33.000Z
2019-06-07T16:36:33.000Z
package com.acornui.build import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.cli.common.messages.MessageRenderer /** * BasicMessageCollector just outputs errors to System.err and everything else to System.out */ class BasicMessageCollector(val verbose: Boolean = true) : MessageCollector { private var _hasErrors = false override fun clear() { } override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) { if (severity.isError) { _hasErrors = true System.err.println(MessageRenderer.PLAIN_FULL_PATHS.render(severity, message, location)) } else { if (verbose || !CompilerMessageSeverity.VERBOSE.contains(severity)) { System.out.println(MessageRenderer.PLAIN_FULL_PATHS.render(severity, message, location)) } } } override fun hasErrors(): Boolean = _hasErrors }
34.366667
110
0.790495
3c8aab3552e9808936241ccd37730806779f695d
1,256
sql
SQL
db.sql
muratyaman/compare-database-structures
d320a60bd861572654372c3d93e090908842eea1
[ "MIT" ]
2
2017-10-05T22:54:02.000Z
2018-04-27T09:15:53.000Z
db.sql
muratyaman/compare-database-structures
d320a60bd861572654372c3d93e090908842eea1
[ "MIT" ]
null
null
null
db.sql
muratyaman/compare-database-structures
d320a60bd861572654372c3d93e090908842eea1
[ "MIT" ]
null
null
null
CREATE TABLE my_hosts ( id INTEGER PRIMARY KEY, host_ref TEXT NOT NULL, last_connected DATETIME ); CREATE INDEX idx_my_hosts_connected ON my_hosts (last_connected); CREATE UNIQUE INDEX unq_my_hosts_ref ON my_hosts (host_ref); CREATE TABLE my_databases ( id INTEGER PRIMARY KEY, db_ref TEXT NOT NULL, last_connected DATETIME, success INTEGER NOT NULL DEFAULT 0 ); CREATE INDEX idx_my_databases_connected ON my_databases (last_connected); CREATE UNIQUE INDEX unq_my_databases_ref ON my_databases (db_ref); CREATE TABLE my_tables ( id INTEGER PRIMARY KEY, db_ref TEXT NOT NULL, schema_name TEXT NOT NULL, table_name TEXT NOT NULL, column_name TEXT NOT NULL, column_type TEXT NOT NULL, column_nullable INTEGER NOT NULL DEFAULT 0, column_attrs TEXT ); CREATE INDEX idx_my_tables_db_ref ON my_tables (db_ref); CREATE INDEX idx_my_tables_schema_name ON my_tables (schema_name); CREATE INDEX idx_my_tables_table_name ON my_tables (table_name); CREATE INDEX idx_my_tables_column_name ON my_tables (column_name); CREATE UNIQUE INDEX unq_my_tables_db_schema_table_col ON my_tables (db_ref, schema_name, table_name, column_name);
34.888889
114
0.743631
ab9dadb331dc58062aee010cb589b96e52d94737
42
rb
Ruby
app/models/advancement.rb
kosen-robocon-db/kosen-robocon-db
47b438059639213e0c737dc36cf5b79cb72526a0
[ "MIT" ]
2
2016-12-10T12:09:33.000Z
2017-01-09T12:20:44.000Z
app/models/advancement.rb
kosen-robocon-db/kosen-robocon-db
47b438059639213e0c737dc36cf5b79cb72526a0
[ "MIT" ]
84
2016-12-08T15:20:12.000Z
2019-01-08T09:05:13.000Z
app/models/advancement.rb
kosen-robocon-db/kosen-robocon-db
47b438059639213e0c737dc36cf5b79cb72526a0
[ "MIT" ]
null
null
null
class Advancement < ApplicationRecord end
14
37
0.857143
56949acc22aff33bb3dd24f326bbc4d841b95b4b
1,688
ts
TypeScript
src/main/main.ts
thenewboston-developers/Wallet
2aa3d75c0031f382edeaed3cae5856123bcb77b6
[ "MIT" ]
8
2021-09-01T06:05:56.000Z
2022-01-10T19:20:22.000Z
src/main/main.ts
thenewboston-developers/Wallet
2aa3d75c0031f382edeaed3cae5856123bcb77b6
[ "MIT" ]
9
2021-08-22T12:59:46.000Z
2021-11-01T01:10:35.000Z
src/main/main.ts
thenewboston-developers/Wallet
2aa3d75c0031f382edeaed3cae5856123bcb77b6
[ "MIT" ]
1
2021-09-26T07:21:28.000Z
2021-09-26T07:21:28.000Z
/* eslint global-require: off, no-console: off, @typescript-eslint/no-var-requires: off */ /** * This module executes inside of electron's main process. You can start * electron renderer process from here and communicate with the other processes * through IPC. * * When running `npm run build` or `npm run build:main`, this file is compiled to * `./src/main.js` using webpack. This gives us some performance wins. */ import 'core-js/stable'; import 'regenerator-runtime/runtime'; import {app, ipcMain} from 'electron'; import AppUpdater from './AppUpdater'; import './ipcMain'; import MainWindow from './MainWindow'; import './Store'; import {isDevelopment} from './util'; export default AppUpdater; ipcMain.on('ipc-example', async (event, arg) => { const msgTemplate = (pingPong: string) => `IPC test: ${pingPong}`; console.log(msgTemplate(arg)); event.reply('ipc-example', msgTemplate('pong')); }); if (process.env.NODE_ENV === 'production') { const sourceMapSupport = require('source-map-support'); sourceMapSupport.install(); } if (isDevelopment) { require('electron-debug')(); } /** * Add event listeners... */ app.on('window-all-closed', () => { // Respect the OSX convention of having the application in memory even // after all windows have been closed if (process.platform !== 'darwin') { app.quit(); } }); app .whenReady() .then(() => { MainWindow.createWindow(); app.on('activate', () => { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (!MainWindow.exists()) MainWindow.createWindow(); }); }) .catch(console.log);
28.133333
90
0.675948
5f45b82d7cf62b018b640ed4ffc0f41bca711e4a
294
ts
TypeScript
src/DirectionEnumType.ts
jean-leonco/graphql-mongo-helpers
bc4a4ead5f7c940d3f99e155096938e922f1a243
[ "MIT" ]
67
2018-10-01T08:52:45.000Z
2022-02-16T17:22:35.000Z
src/DirectionEnumType.ts
jean-leonco/graphql-mongo-helpers
bc4a4ead5f7c940d3f99e155096938e922f1a243
[ "MIT" ]
180
2019-01-17T19:20:02.000Z
2022-03-18T01:02:05.000Z
src/DirectionEnumType.ts
jean-leonco/graphql-mongo-helpers
bc4a4ead5f7c940d3f99e155096938e922f1a243
[ "MIT" ]
8
2019-07-03T19:41:53.000Z
2022-01-17T12:49:48.000Z
import { GraphQLEnumType } from 'graphql'; export const DirectionEnumType = new GraphQLEnumType({ name: 'DirectionEnum', values: { ASC: { value: 1, }, DESC: { value: -1, }, }, }); export const DirectionEnum = ` enum DirectionEnum { ASC DESC } `;
14
54
0.571429
a35f0bb4674f8d9b57373ad32980024a4004d632
8,405
kt
Kotlin
openrndr-ktessellation/src/commonMain/kotlin/Normal.kt
reinvdwoerd/openrndr
83d7ce4b53b205b54a0cbcae57f60c7a6280d34d
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
openrndr-ktessellation/src/commonMain/kotlin/Normal.kt
reinvdwoerd/openrndr
83d7ce4b53b205b54a0cbcae57f60c7a6280d34d
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
openrndr-ktessellation/src/commonMain/kotlin/Normal.kt
reinvdwoerd/openrndr
83d7ce4b53b205b54a0cbcae57f60c7a6280d34d
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
package org.openrndr.ktessellation import kotlin.math.abs import kotlin.math.sqrt internal object Normal { var SLANTED_SWEEP = false var S_UNIT_X /* Pre-normalized */ = 0.0 var S_UNIT_Y = 0.0 private const val TRUE_PROJECT = false private fun Dot(u: DoubleArray, v: DoubleArray): Double { return u[0] * v[0] + u[1] * v[1] + u[2] * v[2] } fun Normalize(v: DoubleArray) { var len = v[0] * v[0] + v[1] * v[1] + v[2] * v[2] require(len > 0) len = sqrt(len) v[0] /= len v[1] /= len v[2] /= len } fun LongAxis(v: DoubleArray): Int { var i = 0 if (abs(v[1]) > abs(v[0])) { i = 1 } if (abs(v[2]) > abs(v[i])) { i = 2 } return i } fun ComputeNormal(tess: GLUtessellatorImpl, norm: DoubleArray) { var v: GLUvertex val v1: GLUvertex val v2: GLUvertex var c: Double var tLen2: Double var maxLen2: Double val maxVal: DoubleArray val minVal: DoubleArray val d1: DoubleArray val d2: DoubleArray val tNorm: DoubleArray val vHead: GLUvertex = tess.mesh!!.vHead var i: Int maxVal = DoubleArray(3) minVal = DoubleArray(3) val minVert: Array<GLUvertex?> = arrayOfNulls<GLUvertex>(3) val maxVert: Array<GLUvertex?> = arrayOfNulls<GLUvertex>(3) d1 = DoubleArray(3) d2 = DoubleArray(3) tNorm = DoubleArray(3) maxVal[2] = -2 * GLU.TESS_MAX_COORD maxVal[1] = maxVal[2] maxVal[0] = maxVal[1] minVal[2] = 2 * GLU.TESS_MAX_COORD minVal[1] = minVal[2] minVal[0] = minVal[1] v = vHead.next?:error("vhead next == null") while (v !== vHead) { i = 0 while (i < 3) { c = v.coords.get(i) if (c < minVal[i]) { minVal[i] = c minVert[i] = v } if (c > maxVal[i]) { maxVal[i] = c maxVert[i] = v } ++i } v = v.next ?: error("v.next == null") } /* Find two vertices separated by at least 1/sqrt(3) of the maximum * distance between any two vertices */i = 0 if (maxVal[1] - minVal[1] > maxVal[0] - minVal[0]) { i = 1 } if (maxVal[2] - minVal[2] > maxVal[i] - minVal[i]) { i = 2 } if (minVal[i] >= maxVal[i]) { /* All vertices are the same -- normal doesn't matter */ norm[0] = 0.0 norm[1] = 0.0 norm[2] = 1.0 return } /* Look for a third vertex which forms the triangle with maximum area * (Length of normal == twice the triangle area) */maxLen2 = 0.0 v1 = minVert[i] ?: error("minVert[$i] == null") v2 = maxVert[i] ?: error("maxVert[$i] == null") d1[0] = v1.coords[0] - v2.coords[0] d1[1] = v1.coords[1] - v2.coords[1] d1[2] = v1.coords[2] - v2.coords[2] v = vHead.next ?: error("vHead.next == null") while (v !== vHead) { d2[0] = v.coords[0] - v2.coords[0] d2[1] = v.coords[1] - v2.coords[1] d2[2] = v.coords[2] - v2.coords[2] tNorm[0] = d1[1] * d2[2] - d1[2] * d2[1] tNorm[1] = d1[2] * d2[0] - d1[0] * d2[2] tNorm[2] = d1[0] * d2[1] - d1[1] * d2[0] tLen2 = tNorm[0] * tNorm[0] + tNorm[1] * tNorm[1] + tNorm[2] * tNorm[2] if (tLen2 > maxLen2) { maxLen2 = tLen2 norm[0] = tNorm[0] norm[1] = tNorm[1] norm[2] = tNorm[2] } v = v.next ?: error("v.next == null") } if (maxLen2 <= 0) { /* All points lie on a single line -- any decent normal will do */ norm[2] = 0.0 norm[1] = norm[2] norm[0] = norm[1] norm[LongAxis(d1)] = 1.0 } } fun CheckOrientation(tess: GLUtessellatorImpl) { var f: GLUface val fHead: GLUface = tess.mesh!!.fHead var v: GLUvertex val vHead: GLUvertex = tess.mesh!!.vHead var e: GLUhalfEdge /* When we compute the normal automatically, we choose the orientation * so that the the sum of the signed areas of all contours is non-negative. */ var area: Double = 0.0 f = fHead.next ?: error("fHead.next == null") while (f !== fHead) { e = f.anEdge ?: error("f.anEdge == null") if (e.winding <= 0) { f = f.next ?: error("f.next == null") continue } do { area += (e.Org!!.s - e.Sym!!.Org!!.s) * (e!!.Org!!.t + e!!.Sym!!.Org!!.t) e = e.Lnext ?: error("e.Lnext == null") } while (e !== f.anEdge) f = f.next ?: error("f.next == null") } if (area < 0) { /* Reverse the orientation by flipping all the t-coordinates */ v = vHead.next ?: error("vHead.next == null") while (v !== vHead) { v.t = -v.t v = v.next ?: error("v.next == null") } tess.tUnit[0] = -tess.tUnit[0] tess.tUnit[1] = -tess.tUnit[1] tess.tUnit[2] = -tess.tUnit[2] } } /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ fun __gl_projectPolygon(tess: GLUtessellatorImpl) { var v: GLUvertex val vHead: GLUvertex = tess.mesh!!.vHead val w: Double val norm = DoubleArray(3) val sUnit: DoubleArray val tUnit: DoubleArray val i: Int var computedNormal = false norm[0] = tess.normal.get(0) norm[1] = tess.normal.get(1) norm[2] = tess.normal.get(2) if (norm[0] == 0.0 && norm[1] == 0.0 && norm[2] == 0.0) { ComputeNormal(tess, norm) computedNormal = true } sUnit = tess.sUnit tUnit = tess.tUnit i = LongAxis(norm) if (TRUE_PROJECT) { /* Choose the initial sUnit vector to be approximately perpendicular * to the normal. */ Normalize(norm) sUnit[i] = 0.0 sUnit[(i + 1) % 3] = S_UNIT_X sUnit[(i + 2) % 3] = S_UNIT_Y /* Now make it exactly perpendicular */w = Dot(sUnit, norm) sUnit[0] -= w * norm[0] sUnit[1] -= w * norm[1] sUnit[2] -= w * norm[2] Normalize(sUnit) /* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */tUnit[0] = norm[1] * sUnit[2] - norm[2] * sUnit[1] tUnit[1] = norm[2] * sUnit[0] - norm[0] * sUnit[2] tUnit[2] = norm[0] * sUnit[1] - norm[1] * sUnit[0] Normalize(tUnit) } else { /* Project perpendicular to a coordinate axis -- better numerically */ sUnit[i] = 0.0 sUnit[(i + 1) % 3] = S_UNIT_X sUnit[(i + 2) % 3] = S_UNIT_Y tUnit[i] = 0.0 tUnit[(i + 1) % 3] = if (norm[i] > 0) -S_UNIT_Y else S_UNIT_Y tUnit[(i + 2) % 3] = if (norm[i] > 0) S_UNIT_X else -S_UNIT_X } /* Project the vertices onto the sweep plane */ v = vHead.next ?: error("vHead.next == null") while (v !== vHead) { v.s = Dot(v.coords, sUnit) v.t = Dot(v.coords, tUnit) v = v.next ?: error("v.next == null") } if (computedNormal) { CheckOrientation(tess) } } init { if (SLANTED_SWEEP) { /* The "feature merging" is not intended to be complete. There are * special cases where edges are nearly parallel to the sweep line * which are not implemented. The algorithm should still behave * robustly (ie. produce a reasonable tesselation) in the presence * of such edges, however it may miss features which could have been * merged. We could minimize this effect by choosing the sweep line * direction to be something unusual (ie. not parallel to one of the * coordinate axes). */ S_UNIT_X = 0.50941539564955385 /* Pre-normalized */ S_UNIT_Y = 0.86052074622010633 } else { S_UNIT_X = 1.0 S_UNIT_Y = 0.0 } } }
33.486056
89
0.491136
b216cae21e8fcc23f6453ee146e2e674b7ef641e
2,615
kt
Kotlin
androidApp/src/main/java/com/prof18/moneyflow/features/categories/CategoriesScreen.kt
snijsure/MoneyFlow
65666f4ffa8758feebd37fd72386eba0c2cfb9fb
[ "Apache-2.0" ]
1
2021-03-18T23:19:27.000Z
2021-03-18T23:19:27.000Z
androidApp/src/main/java/com/prof18/moneyflow/features/categories/CategoriesScreen.kt
snijsure/MoneyFlow
65666f4ffa8758feebd37fd72386eba0c2cfb9fb
[ "Apache-2.0" ]
null
null
null
androidApp/src/main/java/com/prof18/moneyflow/features/categories/CategoriesScreen.kt
snijsure/MoneyFlow
65666f4ffa8758feebd37fd72386eba0c2cfb9fb
[ "Apache-2.0" ]
null
null
null
package com.prof18.moneyflow.features.categories import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.Divider import androidx.compose.material.Scaffold import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.NavController import com.prof18.moneyflow.NavigationArguments import com.prof18.moneyflow.features.categories.components.CategoryCard import com.prof18.moneyflow.features.categories.data.toCategoryUIData import com.prof18.moneyflow.ui.components.Loader import com.prof18.moneyflow.ui.components.MFTopBar import com.prof18.moneyflow.presentation.categories.CategoryModel @Composable fun CategoriesScreen( navController: NavController, isFromAddTransaction: Boolean, ) { val viewModel = viewModel<CategoriesViewModel>( factory = CategoriesViewModelFactory() ) Scaffold( topBar = { MFTopBar( topAppBarText = "Categories", actionTitle = "Add", onBackPressed = { navController.popBackStack() }, onActionClicked = { // TODO }, actionEnabled = true ) }, content = { when (viewModel.categoryModel) { CategoryModel.Loading -> Loader() is CategoryModel.Error -> { Text((viewModel.categoryModel as CategoryModel.Error).message) } is CategoryModel.CategoryState -> { LazyColumn { items((viewModel.categoryModel as CategoryModel.CategoryState).categories) { CategoryCard( category = it, onClick = { category -> if (isFromAddTransaction) { navController.previousBackStackEntry?.savedStateHandle?.set( NavigationArguments.CATEGORY, category.toCategoryUIData() ) navController.popBackStack() } } ) Divider() } } } } } ) }
35.821918
100
0.531549
bbb98f7ad00b31a77bc102036bef510609d27255
5,424
rs
Rust
msgpacker/tests/pack_unpack.rs
codx-dev/msgpacker
b1b7476df8019ba3020be1afc40e801b53668484
[ "Apache-2.0", "MIT" ]
null
null
null
msgpacker/tests/pack_unpack.rs
codx-dev/msgpacker
b1b7476df8019ba3020be1afc40e801b53668484
[ "Apache-2.0", "MIT" ]
null
null
null
msgpacker/tests/pack_unpack.rs
codx-dev/msgpacker
b1b7476df8019ba3020be1afc40e801b53668484
[ "Apache-2.0", "MIT" ]
null
null
null
use msgpacker::prelude::*; use std::io::{self, Cursor, Seek}; use std::time::Duration; #[test] fn pack_unpack() -> io::Result<()> { let buffer = vec![0u8; 4096]; let mut cursor = Cursor::new(buffer); let mut cases = vec![ Message::Nil, Message::Boolean(true), Message::Boolean(false), Message::Integer(Integer::signed(i64::MIN)), Message::Integer(Integer::signed(i32::MIN as i64 - 1)), Message::Integer(Integer::signed(i32::MIN as i64)), Message::Integer(Integer::signed(i16::MIN as i64 - 1)), Message::Integer(Integer::signed(i16::MIN as i64)), Message::Integer(Integer::signed(i8::MIN as i64 - 1)), Message::Integer(Integer::signed(i8::MIN as i64)), Message::Integer(Integer::signed(-32)), Message::Integer(Integer::signed(-1)), Message::Integer(Integer::unsigned(0u64)), Message::Integer(Integer::unsigned(1u64)), Message::Integer(Integer::unsigned(127u64)), Message::Integer(Integer::unsigned(128u64)), Message::Integer(Integer::unsigned(u8::MAX as u64)), Message::Integer(Integer::unsigned(u8::MAX as u64 + 1)), Message::Integer(Integer::unsigned(u16::MAX as u64)), Message::Integer(Integer::unsigned(u16::MAX as u64 + 1)), Message::Integer(Integer::unsigned(u32::MAX as u64)), Message::Integer(Integer::unsigned(u32::MAX as u64 + 1)), Message::Integer(Integer::unsigned(u64::MAX)), Message::Float(Float::F32(f32::EPSILON)), Message::Float(Float::F32(f32::MIN)), Message::Float(Float::F32(f32::MIN_POSITIVE)), Message::Float(Float::F32(f32::MAX)), Message::Float(Float::F32(f32::INFINITY)), Message::Float(Float::F32(f32::NEG_INFINITY)), Message::Float(Float::F64(f64::EPSILON)), Message::Float(Float::F64(f64::MIN)), Message::Float(Float::F64(f64::MIN_POSITIVE)), Message::Float(Float::F64(f64::MAX)), Message::Float(Float::F64(f64::INFINITY)), Message::Float(Float::F64(f64::NEG_INFINITY)), Message::String(String::from("")), Message::String(unsafe { String::from_utf8_unchecked(vec!['a' as u8; 31]) }), Message::String(unsafe { String::from_utf8_unchecked(vec!['a' as u8; 32]) }), Message::String(unsafe { String::from_utf8_unchecked(vec!['a' as u8; u8::MAX as usize]) }), Message::String(unsafe { String::from_utf8_unchecked(vec!['a' as u8; u8::MAX as usize + 1]) }), Message::String(unsafe { String::from_utf8_unchecked(vec!['a' as u8; u16::MAX as usize]) }), Message::String(unsafe { String::from_utf8_unchecked(vec!['a' as u8; u16::MAX as usize + 1]) }), Message::Bin(vec![]), Message::Bin(vec![0xbe; 31]), Message::Bin(vec![0xef; 32]), Message::Bin(vec![0xbe; u8::MAX as usize]), Message::Bin(vec![0xef; u8::MAX as usize + 1]), Message::Bin(vec![0xbe; u16::MAX as usize]), Message::Bin(vec![0xef; u16::MAX as usize + 1]), Message::Extension(Extension::FixExt1(-2, 1)), Message::Extension(Extension::FixExt2(-2, [1; 2])), Message::Extension(Extension::FixExt4(-2, [1; 4])), Message::Extension(Extension::FixExt8(-2, [1; 8])), Message::Extension(Extension::FixExt16(-2, [1; 16])), Message::Extension(Extension::Ext(-2, vec![])), Message::Extension(Extension::Ext(-2, vec![1; u8::MAX as usize])), Message::Extension(Extension::Ext(-2, vec![1; u8::MAX as usize + 1])), Message::Extension(Extension::Ext(-2, vec![1; u16::MAX as usize])), Message::Extension(Extension::Ext(-2, vec![1; u16::MAX as usize + 1])), Message::Extension(Extension::Timestamp(Duration::new(0, 0))), Message::Extension(Extension::Timestamp(Duration::new(1, 0))), Message::Extension(Extension::Timestamp(Duration::new(u32::MAX as u64, 0))), Message::Extension(Extension::Timestamp(Duration::new(u32::MAX as u64 + 1, 0))), Message::Extension(Extension::Timestamp(Duration::new(u32::MAX as u64 + 1, 1))), Message::Extension(Extension::Timestamp(Duration::new( u32::MAX as u64 + 1, (1u32 << 30) - 1, ))), Message::Extension(Extension::Timestamp(Duration::new((1u64 << 34) - 1, 10000))), Message::Extension(Extension::Timestamp(Duration::new(1u64 << 34, 10000))), Message::Extension(Extension::Timestamp(Duration::new(u64::MAX, 10000))), ]; let map = cases .as_slice() .windows(2) .map(|w| MapEntry::new(w[0].clone(), w[1].clone())) .collect(); cases.push(Message::Map(map)); cases.push(Message::Array(cases.clone())); for m in cases { m.pack(&mut cursor)?; cursor.rewind()?; let buf_msg = cursor.get_ref().clone(); let m_p = Message::unpack(&mut cursor)?; cursor.rewind()?; let m_ref = m.to_ref(); let m_o = unsafe { m_ref.clone().into_owned() }; let buf_ref = cursor.get_ref().clone(); m_ref.pack(&mut cursor)?; cursor.rewind()?; let m_ref_p = unsafe { MessageRef::unpack(&mut cursor)? }; cursor.rewind()?; assert_eq!(buf_msg, buf_ref); assert_eq!(m, m_o); assert_eq!(m, m_p); assert_eq!(m_ref, m_ref_p); } Ok(()) }
43.047619
100
0.58868
b64d1a4de5b749e0d1cb4aadd8564d8fa0a183df
798
rb
Ruby
lib/rscons/builders/library.rb
holtrop/rscons
117df43f649e7a133e47668cd801a27900f2fd39
[ "MIT" ]
null
null
null
lib/rscons/builders/library.rb
holtrop/rscons
117df43f649e7a133e47668cd801a27900f2fd39
[ "MIT" ]
133
2015-01-20T18:52:09.000Z
2022-03-14T04:34:55.000Z
lib/rscons/builders/library.rb
holtrop/rscons
117df43f649e7a133e47668cd801a27900f2fd39
[ "MIT" ]
3
2017-06-04T16:03:11.000Z
2020-03-03T22:32:08.000Z
module Rscons module Builders # A default Rscons builder that produces a static library archive. class Library < Builder include Mixins::ObjectDeps # Create an instance of the Builder to build a target. def initialize(options) super(options) @objects = register_object_deps(Object) end # Run the builder to produce a build target. def run(options) if @command finalize_command(sources: @objects) true else @vars["_TARGET"] = @target @vars["_SOURCES"] = @objects command = @env.build_command("${ARCMD}", @vars) standard_command("Building static library archive <target>#{@target}<reset>", command, sources: @objects) end end end end end
26.6
115
0.615288
040e026a7f38e68736f132f11880419c8fda63fb
3,160
js
JavaScript
tests/notes.test.js
xo-energy/action-get-or-create-release
f69bec6b109f38b86fa652f4ae2968f4d09a7cbd
[ "0BSD" ]
null
null
null
tests/notes.test.js
xo-energy/action-get-or-create-release
f69bec6b109f38b86fa652f4ae2968f4d09a7cbd
[ "0BSD" ]
5
2020-11-16T20:24:31.000Z
2021-08-03T20:14:59.000Z
tests/notes.test.js
xo-energy/action-get-or-create-release
f69bec6b109f38b86fa652f4ae2968f4d09a7cbd
[ "0BSD" ]
null
null
null
jest.mock("@actions/github", () => { return { context: { repo: { owner: "org", repo: "project", }, }, }; }); jest.unmock("../src/notes"); const notes = require("../src/notes"); const issue57 = { action: "Fixes", slug: undefined, prefix: "#", issue: "57", raw: "fixes #57", }; const issue58 = { action: "Fixes", slug: undefined, prefix: "#", issue: "58", raw: "fixes #58", }; const issue59 = { action: "Resolves", slug: undefined, prefix: "#", issue: "59", raw: "resolves #59", }; const issue60 = { action: "Closes", slug: "owner/repo", prefix: "#", issue: "60", raw: "closes owner/repo#60", }; const mockCommits = [ { sha: "abc", commit: { author: { name: "User1" }, message: "Fix error\n\nfixes #1", }, author: { login: "user" }, }, { sha: "def", commit: { author: { name: "User1" }, message: "Add feature\n\ncloses #2", }, author: { login: "user" }, }, { sha: "ghi", commit: { author: { name: "Contributor1" }, message: "Add feature\n\nTwo birds with one stone!\n\ncloses #3, closes #4", }, author: { login: "contributor" }, }, { sha: "xyz", commit: { author: { name: "User1" }, message: "Cleanup", }, author: { login: "user" }, }, ]; const mockGitHub = { rest: { repos: { compareCommits: { endpoint: { merge: jest.fn(), }, }, }, }, paginate: { iterator: jest.fn(), }, }; describe("getClosers", () => { test("works on empty message", () => { expect(notes.getClosers("")).toEqual([]); }); test("finds issue number", () => { expect(notes.getClosers("Fix some things\n\nfixes #57")).toEqual([issue57]); }); test("finds multiple issue numbers", () => { expect(notes.getClosers("Fix some things\n\nfixes #57, fixes #58")).toEqual([issue57, issue58]); }); test("finds multiple issue numbers on multiple lines", () => { expect(notes.getClosers("Fix some things\n\nfixes #57\nfixes #58")).toEqual([issue57, issue58]); }); test("finds 'resolves'", () => { expect(notes.getClosers("Fix some things\n\nresolves #59")).toEqual([issue59]); }); test("finds 'closes' other repo", () => { expect(notes.getClosers("Fix some things\n\ncloses owner/repo#60")).toEqual([issue60]); }); }); describe("getReleaseNotes", () => { beforeAll(() => { mockGitHub.paginate.iterator.mockReturnValue({ *[Symbol.iterator]() { yield { data: { commits: mockCommits } }; }, }); }); test("matches template", async () => { const output = await notes.getReleaseNotes(mockGitHub, null, "abc", "xyz"); expect(output).toEqual( ` # Changes - abc Fix error ([User1](https://github.com/org/project/commits?author=user); fixes #1) - def Add feature ([User1](https://github.com/org/project/commits?author=user); fixes #2) - ghi Add feature ([Contributor1](https://github.com/org/project/commits?author=contributor); fixes #3 #4) - xyz Cleanup ([User1](https://github.com/org/project/commits?author=user)) `.trimLeft() ); }); });
22.898551
106
0.560127
a0e070bdc046ba4043e813b268b5a7aac38668a0
240
swift
Swift
Sources/HeaderTransitionKit/Internal/Protocols/HTStatusBarUpdating.swift
Pomanks/header-transition-kit
69639f36d673bb7fcfee39bece18055492897594
[ "MIT" ]
null
null
null
Sources/HeaderTransitionKit/Internal/Protocols/HTStatusBarUpdating.swift
Pomanks/header-transition-kit
69639f36d673bb7fcfee39bece18055492897594
[ "MIT" ]
null
null
null
Sources/HeaderTransitionKit/Internal/Protocols/HTStatusBarUpdating.swift
Pomanks/header-transition-kit
69639f36d673bb7fcfee39bece18055492897594
[ "MIT" ]
null
null
null
// // HTStatusBarUpdating.swift // // // Created by Antoine Barré on 3/31/21. // import UIKit protocol HTStatusBarUpdating: UIViewController { var statusBarStyle: UIStatusBarStyle { get } var barStyle: UIBarStyle { get set } }
16
48
0.704167
2f32be49a57f26a087b07093e7fafe7d94a93d89
545
php
PHP
components/RecentComments.php
belyash23/internship-blog
f383439e81352aeabbee332d4dc80e9df589c6dd
[ "BSD-3-Clause" ]
null
null
null
components/RecentComments.php
belyash23/internship-blog
f383439e81352aeabbee332d4dc80e9df589c6dd
[ "BSD-3-Clause" ]
null
null
null
components/RecentComments.php
belyash23/internship-blog
f383439e81352aeabbee332d4dc80e9df589c6dd
[ "BSD-3-Clause" ]
null
null
null
<?php namespace app\components; use app\models\Comment; use yii\base\Widget; class RecentComments extends Widget { public $title = 'Recent Comments'; public $maxComments = 10; public function getRecentComments() { return Comment::findRecentComments($this->maxComments); } public function run() { return $this->render( 'recentComments', [ 'recentComments' => $this->recentComments, 'title' => $this->title, ] ); } }
18.166667
63
0.561468
267376348893a7dde0ebf678160ad69f6af9a339
1,314
java
Java
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/askforleave/rule/AskForLeaveCodeRule.java
Razer1911/e-school
5522c38521eb5431ac9fa3065761da33288c39f4
[ "Apache-2.0" ]
1
2021-01-30T14:13:13.000Z
2021-01-30T14:13:13.000Z
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/askforleave/rule/AskForLeaveCodeRule.java
Razer1911/e-school
5522c38521eb5431ac9fa3065761da33288c39f4
[ "Apache-2.0" ]
6
2020-08-11T15:22:18.000Z
2022-02-27T03:48:58.000Z
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/askforleave/rule/AskForLeaveCodeRule.java
Razer1911/e-school
5522c38521eb5431ac9fa3065761da33288c39f4
[ "Apache-2.0" ]
null
null
null
package org.jeecg.modules.demo.askforleave.rule; import cn.hutool.core.date.DateUtil; import cn.hutool.core.text.StrFormatter; import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSONObject; import org.jeecg.common.handler.IFillRuleHandler; import org.jeecg.common.util.SpringContextUtils; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.support.atomic.RedisAtomicLong; import java.util.Date; import java.util.Objects; import java.util.concurrent.TimeUnit; /** * @author naiyu */ public class AskForLeaveCodeRule implements IFillRuleHandler { @Override public Object execute(JSONObject params, JSONObject formData) { RedisTemplate redisTemplate = (RedisTemplate) SpringContextUtils.getBean("redisTemplate"); //生成时间戳 String timestamp = DateUtil.format(new Date(), "yyyyMMddHHmm"); RedisAtomicLong entityIdCounter = new RedisAtomicLong("Q" + timestamp, Objects.requireNonNull(redisTemplate.getConnectionFactory())); long increment = entityIdCounter.getAndIncrement(); if (increment == 0) { //初始设置过期时间 entityIdCounter.expire(5, TimeUnit.MINUTES); } return StrFormatter.format("Q{}{}", timestamp, NumberUtil.decimalFormat("0000", increment)); } }
35.513514
141
0.744292
6684f1fda2ce018ea8695807679057517156f801
2,290
kt
Kotlin
plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleStateService.kt
tgodzik/intellij-community
f5ef4191fc30b69db945633951fb160c1cfb7b6f
[ "Apache-2.0" ]
1
2019-08-02T21:11:19.000Z
2019-08-02T21:11:19.000Z
plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleStateService.kt
tgodzik/intellij-community
f5ef4191fc30b69db945633951fb160c1cfb7b6f
[ "Apache-2.0" ]
null
null
null
plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleStateService.kt
tgodzik/intellij-community
f5ef4191fc30b69db945633951fb160c1cfb7b6f
[ "Apache-2.0" ]
1
2019-09-13T08:16:15.000Z
2019-09-13T08:16:15.000Z
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.console import com.intellij.openapi.components.* import com.intellij.openapi.module.Module import com.intellij.openapi.module.ModulePointer import com.intellij.openapi.module.ModulePointerManager import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileManager import org.jetbrains.plugins.groovy.console.GroovyConsoleStateService.MyState import java.util.* @State(name = "GroovyConsoleState", storages = [Storage(StoragePathMacros.WORKSPACE_FILE)]) class GroovyConsoleStateService( private val modulePointerManager: ModulePointerManager, private val fileManager: VirtualFileManager ) : PersistentStateComponent<MyState> { private val myFileModuleMap: MutableMap<VirtualFile, ModulePointer?> = Collections.synchronizedMap(HashMap()) class Entry { var url: String? = null var moduleName: String? = null } class MyState { var list: MutableCollection<Entry> = ArrayList() } override fun getState(): MyState { synchronized(myFileModuleMap) { val result = MyState() for ((file, pointer) in myFileModuleMap) { val e = Entry() e.url = file.url e.moduleName = pointer?.moduleName result.list.add(e) } return result } } override fun loadState(state: MyState) { synchronized(myFileModuleMap) { myFileModuleMap.clear() for (entry in state.list) { val url = entry.url ?: continue val file = fileManager.findFileByUrl(url) ?: continue val pointer = entry.moduleName?.let(modulePointerManager::create) myFileModuleMap[file] = pointer } } } fun isProjectConsole(file: VirtualFile): Boolean { return myFileModuleMap.containsKey(file) } fun getSelectedModule(file: VirtualFile): Module? = myFileModuleMap[file]?.module fun setFileModule(file: VirtualFile, module: Module?) { myFileModuleMap[file] = module?.let(modulePointerManager::create) } companion object { @JvmStatic fun getInstance(project: Project): GroovyConsoleStateService = project.service() } }
32.253521
140
0.731878
0d1c77507b560a44dffaf295a2343f8cc5ff5e9c
878
asm
Assembly
data/pokemon/base_stats/groudon.asm
TastySnax12/pokecrystal16-493-plus
9de36c8803c9bdf4b8564ed547f988b0b66f0c41
[ "blessing" ]
2
2021-07-31T07:05:06.000Z
2021-10-16T03:32:26.000Z
data/pokemon/base_stats/groudon.asm
TastySnax12/pokecrystal16-493-plus
9de36c8803c9bdf4b8564ed547f988b0b66f0c41
[ "blessing" ]
null
null
null
data/pokemon/base_stats/groudon.asm
TastySnax12/pokecrystal16-493-plus
9de36c8803c9bdf4b8564ed547f988b0b66f0c41
[ "blessing" ]
3
2021-01-15T18:45:40.000Z
2021-10-16T03:35:27.000Z
db 0 ; species ID placeholder db 100, 150, 140, 90, 100, 90 ; hp atk def spd sat sdf db GROUND, GROUND ; type db 5 ; catch rate db 218 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_UNKNOWN ; gender ratio db 100 ; unknown 1 db 120 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/groudon/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_SLOW ; growth rate dn EGG_NONE, EGG_NONE ; egg groups ; tm/hm learnset tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, ROAR, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, HYPER_BEAM, PROTECT, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, DRAGONBREATH, THUNDER, EARTHQUAKE, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, FIRE_BLAST, SWIFT, DEFENSE_CURL, THUNDERPUNCH, DETECT, REST, FIRE_PUNCH, FURY_CUTTER, CUT, STRENGTH, FLAMETHROWER, THUNDERBOLT ; end
39.909091
418
0.738041
87619598ba75608b5048515d67a821aa08934721
59
asm
Assembly
audio/sfx/snare8_2.asm
etdv-thevoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
1
2022-01-09T05:28:52.000Z
2022-01-09T05:28:52.000Z
audio/sfx/snare8_2.asm
ETDV-TheVoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
null
null
null
audio/sfx/snare8_2.asm
ETDV-TheVoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
null
null
null
SFX_Snare8_2_Ch7: unknownnoise0x20 0, 130, 37 endchannel
14.75
28
0.813559
3eacaa1b75f48b9611c8a2b86cd5595b4c7049fb
212
swift
Swift
ShipTests/Mocks/DependencyMock.swift
taoshotaro/Ship
62f13a017df17ec5c098d5ca5d483df740f8cab0
[ "MIT" ]
29
2019-04-24T08:16:41.000Z
2021-02-16T11:02:52.000Z
ShipTests/Mocks/DependencyMock.swift
taoshotaro/Ship
62f13a017df17ec5c098d5ca5d483df740f8cab0
[ "MIT" ]
2
2019-05-13T05:12:44.000Z
2021-02-17T01:05:32.000Z
ShipTests/Mocks/DependencyMock.swift
taoshotaro/Ship
62f13a017df17ec5c098d5ca5d483df740f8cab0
[ "MIT" ]
3
2019-10-06T02:17:55.000Z
2021-02-16T09:40:22.000Z
import Ship import Foundation final class DependencyMock: Dependency { var baseURL = URL(string: "http://test.test")! func buildBaseURL<R: Request>(_ request: R) -> URL { return baseURL } }
19.272727
56
0.660377